getUnreadNotificationCount() aggregates both the room-level counter and all
thread notification counters. The stale-clamping logic checked whether the
latest main-timeline event was already read and, if so, set total = 0 — this
inadvertently wiped out any thread reply counts that were included in the
combined total.
Fix by reading getRoomUnreadNotificationCount() (main-timeline only) to
determine the stale portion, then subtracting only that from total rather than
zeroing the whole value. Thread highlight and total counts are preserved.
When a DM room is also a child of a space, its unread counts were propagating
upward into the space's aggregated badge, causing the space to show a badge
even though the unread belonged to a direct message.
In the roomToUnreadAtom write function, check mDirectAtom before calling
getAllParents: if the room is a DM, use an empty parent set so its unread
stays isolated to the direct tab and does not roll up into any space badge.
- Use highlight count on highlighted badge, total on standard (matching the
fix applied to other sidebar call sites)
- Add useRoomHasUnread hook that subscribes reactively to RoomEvent.Timeline
and RoomEvent.Receipt to detect unread messages independently of push-rule
notification counts
- When a room has unread messages but no notification count entry (e.g. a
mentions-only room with new regular messages), show a dot badge (count=0)
rather than no badge at all, matching the behaviour of other Matrix clients
- Also bold the room name and restore icon opacity for these rooms
The UnreadBadge supports a separate highlight count and total count, but all
call sites were only passing the total. Update DirectTab, HomeTab, SpaceTabs,
and Search to pass the highlight count when the badge is in highlight state,
so @-mention counts are reflected accurately in the sidebar.