From f9499dd881f9e82aa78efbe01d8485f250c33c9d Mon Sep 17 00:00:00 2001 From: Nagajyothi Date: Fri, 20 Feb 2026 09:52:19 +0000 Subject: [PATCH 1/3] fix: unread count for DMs when user has mentions-only preference --- apps/meteor/app/lib/server/lib/notifyUsersOnMessage.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/meteor/app/lib/server/lib/notifyUsersOnMessage.ts b/apps/meteor/app/lib/server/lib/notifyUsersOnMessage.ts index 80cf172c9dcb1..af6961c53bf4a 100644 --- a/apps/meteor/app/lib/server/lib/notifyUsersOnMessage.ts +++ b/apps/meteor/app/lib/server/lib/notifyUsersOnMessage.ts @@ -115,7 +115,7 @@ async function updateUsersSubscriptions(message: IMessage, room: IRoom): Promise await Subscriptions.incGroupMentionsAndUnreadForRoomIdExcludingUserId(room._id, message.u._id, 1, groupMentionInc); } - if (!toAll && !toHere && unreadAllMessages) { + if (!toAll && !toHere && (unreadAllMessages || room.t === 'd')) { await Subscriptions.incUnreadForRoomIdExcludingUserIds(room._id, [...userIds, message.u._id], 1); } From e716668a51030c5cb92bdf3e42993e71f5724c9f Mon Sep 17 00:00:00 2001 From: Nagajyothi Date: Fri, 20 Feb 2026 15:29:45 +0000 Subject: [PATCH 2/3] fix: sync real-time unread count for DMs in shouldIncUnread --- apps/meteor/app/lib/server/lib/notifyUsersOnMessage.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/meteor/app/lib/server/lib/notifyUsersOnMessage.ts b/apps/meteor/app/lib/server/lib/notifyUsersOnMessage.ts index af6961c53bf4a..8ae531b41eea8 100644 --- a/apps/meteor/app/lib/server/lib/notifyUsersOnMessage.ts +++ b/apps/meteor/app/lib/server/lib/notifyUsersOnMessage.ts @@ -127,7 +127,7 @@ async function updateUsersSubscriptions(message: IMessage, room: IRoom): Promise subs.forEach((sub) => { const hasUserMention = userIds.includes(sub.u._id); - const shouldIncUnread = hasUserMention || toAll || toHere || unreadAllMessages; + const shouldIncUnread = hasUserMention || toAll || toHere || unreadAllMessages || room.t === 'd'; void notifyOnSubscriptionChanged( { ...sub, From f615f02731ffdba0e46c398d36c7edc74caa27bf Mon Sep 17 00:00:00 2001 From: Nagajyothi Date: Sat, 21 Feb 2026 05:48:14 +0000 Subject: [PATCH 3/3] fix: sync real-time unread updates for DMs and refine query logic --- apps/meteor/app/lib/server/lib/notifyUsersOnMessage.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/meteor/app/lib/server/lib/notifyUsersOnMessage.ts b/apps/meteor/app/lib/server/lib/notifyUsersOnMessage.ts index 8ae531b41eea8..c7102104e302c 100644 --- a/apps/meteor/app/lib/server/lib/notifyUsersOnMessage.ts +++ b/apps/meteor/app/lib/server/lib/notifyUsersOnMessage.ts @@ -105,7 +105,7 @@ async function updateUsersSubscriptions(message: IMessage, room: IRoom): Promise roomId: room._id, uidsExclude: [message.u._id], uidsInclude: userIds, - onlyRead: !toAll && !toHere && !unreadAllMessages, + onlyRead: !toAll && !toHere && !unreadAllMessages && room.t !== 'd', }).toArray(); // Give priority to user mentions over group mentions @@ -132,7 +132,7 @@ async function updateUsersSubscriptions(message: IMessage, room: IRoom): Promise { ...sub, alert: true, - open: true, + // open: true, ...(shouldIncUnread && { unread: sub.unread + 1 }), ...(hasUserMention && { userMentions: sub.userMentions + 1 }), ...((toAll || toHere) && { groupMentions: sub.groupMentions + 1 }),