fix(notifications/threads): Wave-1 audit fixes (🔴 + web 🟠)
- T1 (🔴): markThreadAsRead no longer receipts the thread ROOT (a 2nd instance of the read-marker-corruption regression — opening a thread whose root is old re-lit the whole room). Extracted to a pure threadReceipt.ts + 5 regression tests. - N1 (🔴): favicon/tab-title unread count now sums only leaf rooms (was double- counting every ancestor-space aggregate in roomToUnread). - N2 (🔴): notifications/sounds dedupe on the event id, not the unread count — fixes "read a DM, next message never notifies again". - T4 (🟠): the thread notification path no longer re-gates on the room count, so an explicit per-thread "All replies" override in a Mentions-only room fires. - N3 (🟠): getUnreadInfos skips phantom {0,0} entries (muted-thread-only rooms no longer light the nav row / pollute unread filters). - N4 (🟠): the Receipt handler recomputes unread instead of blanket-DELETE, so a threaded receipt can't wipe a room's valid main-timeline badge. - T2 (🟠): thread "Jump to Latest" re-anchors the virtual window (was landing on a stale mid/old event). Gates: tsc/eslint/prettier clean, build OK, 678 tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -269,7 +269,15 @@ export const getUnreadInfos = (
|
||||
|
||||
if (roomHaveNotification(room) || roomHaveUnread(mx, room)) {
|
||||
const mutedThreads = content ? getMutedThreads(content, room.roomId) : undefined;
|
||||
unread.push(getUnreadInfo(room, mutedThreads));
|
||||
const info = getUnreadInfo(room, mutedThreads);
|
||||
// Skip a phantom {0,0} entry: a room whose ONLY unread is a muted thread has
|
||||
// roomHaveNotification true (the server room total includes the muted
|
||||
// thread's count), but getUnreadInfo subtracts it back to zero. Pushing it
|
||||
// would still light the nav row + pollute "unread only" filters. Keep it
|
||||
// only if there's real unread (count > 0) or a genuine unread marker.
|
||||
if (info.total > 0 || info.highlight > 0 || roomHaveUnread(mx, room)) {
|
||||
unread.push(info);
|
||||
}
|
||||
}
|
||||
|
||||
return unread;
|
||||
|
||||
Reference in New Issue
Block a user