Task #43: Stop counting system messages as unread
Problem: Group rename, member-add, and member-remove events insert rows into the messages table with the actor as senderId, which made them increment the unread badge for everyone else just like a normal chat message. That created notification noise for routine admin tweaks. Fix: In `artifacts/api-server/src/routes/conversations.ts`, the `buildConversationDetails` unread count query now restricts to `messages.kind = 'user'`, so only real user chat messages contribute to the unread count returned for the conversation list / bell badge. Notes / non-changes: - The conversation-list "last message" preview is intentionally left unfiltered, so the most recent activity (including system messages) still surfaces in the list — matches the task's "Done looks like". - Push-style chat notifications (`createMessageNotifications`) are only invoked from the user send-message route, never from `insertAndEmitSystemMessage`, so no additional guard is required for system events today. - Frontend chat.tsx already renders system messages distinctly and shows them in the list preview; no UI change needed. Replit-Task-Id: 3734d73b-2df7-4f32-9655-6c7a9e23536c
This commit is contained in:
@@ -116,6 +116,7 @@ async function buildConversationDetails(conversationId: number, currentUserId: n
|
||||
.where(
|
||||
and(
|
||||
eq(messagesTable.conversationId, conversationId),
|
||||
eq(messagesTable.kind, "user"),
|
||||
sql`${messagesTable.id} NOT IN (
|
||||
SELECT message_id FROM message_reads WHERE user_id = ${currentUserId}
|
||||
)`,
|
||||
|
||||
Reference in New Issue
Block a user