fix(dm): render system messages in sidebar preview instead of raw JSON
DmLastMessagePreview lacked a `type` field, so the sidebar rendered
`lastMessage.content` verbatim — surfacing JSON like
`{"event":"space_invite",...}` for space invites and member-add events.
Adds `type` to the preview payload (populated server-side from
`dm_messages.type`) and routes all sidebar call sites through a single
`formatDmSidebarPreview` helper that renders human-readable text for
each system event and skips the group `Sender:` prefix on system rows.
This commit is contained in:
@@ -1328,6 +1328,7 @@ function buildReadyPayload(userId: string): {
|
||||
userId: last.userId,
|
||||
content: last.content,
|
||||
createdAt: last.createdAt,
|
||||
type: last.type === 'system' ? 'system' : 'user',
|
||||
attachments: dmLastMsgAttachmentMap.get(last.id) ?? [],
|
||||
} : null,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user