Skip to content
This repository was archived by the owner on Mar 10, 2026. It is now read-only.

fix(badges): accurate unread counts and dot badge for non-notifying rooms#118

Merged
7w1 merged 4 commits into7w1:devfrom
CloudHub-Social:fix/badge-improvements
Mar 4, 2026
Merged

fix(badges): accurate unread counts and dot badge for non-notifying rooms#118
7w1 merged 4 commits into7w1:devfrom
CloudHub-Social:fix/badge-improvements

Conversation

@Just-Insane
Copy link
Collaborator

Description

Changes:

  • Highlight-first counts — badges now show the highlight (mention) count when there are highlights, falling back to total otherwise. Applies to sidebar tabs, space badges, and search.
  • Dot badge for silent rooms — rooms with unread messages but no notification count (e.g. mentions-only) now show a dot badge and bold room name in the nav.
  • DM rooms excluded from space badges — DM unreads no longer bubble up into parent space badge counts.
  • Thread counts preserved — the stale-event clamping logic no longer wipes thread reply counts; it now subtracts only the main-timeline portion.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

Evie Gauthier added 4 commits March 4, 2026 10:54
…ndard

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.
…fying rooms

- 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
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.
…main-timeline total

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.
@7w1 7w1 merged commit 3ed67ad into 7w1:dev Mar 4, 2026
4 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants