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:
Jannis Braun
2026-04-29 23:13:09 +02:00
parent 9aa97f4552
commit 1ed70a90b1
7 changed files with 164 additions and 23 deletions
+1
View File
@@ -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,
});