main ← fix-bookmark-count
opened 10:52AM - 24 Dec 25 UTC
Previously, `UserSummary#bookmark_count` used a simple database count
that incl…uded all bookmarks regardless of whether the user could still
access the bookmarked content. This led to inflated counts when:
- Topics were moved to private categories the user can't access
- Topics or posts were soft-deleted
- Access was revoked for any other reason
The fix delegates counting to `BookmarkQuery#count_all`, which applies
the same permission checks used when listing bookmarks. This ensures
the count shown on user profiles matches what users can actually see.
To avoid duplicating query logic, the existing `list_all` method was
refactored to extract `build_list_queries` as a shared helper. The
`unread_notifications` method was also cleaned up by breaking out
several smaller private methods for better readability.
Ref - https://meta.discourse.org/t/391822