Skip to content

Conversation

@chrisbobbe
Copy link
Collaborator

Fixes-partly: #1088


A follow-up to #1959, clearing one of the TODOs on the UnreadCountBadge widget.

Screenshots:

Before After
image image
image image

@chrisbobbe
Copy link
Collaborator Author

cc @alya

@chrisbobbe chrisbobbe added the product review Added by maintainers when a PR needs product review label Nov 20, 2025
@chrisbobbe chrisbobbe force-pushed the pr-main-menu-unread-counts branch from 109e8dc to b33421b Compare November 20, 2025 22:13
Copy link
Member

@rajveermalviya rajveermalviya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @chrisbobbe! LGTM, moving over to Greg's review.

@rajveermalviya rajveermalviya added integration review Added by maintainers when PR may be ready for integration and removed maintainer review PR ready for review by Zulip maintainers labels Nov 21, 2025
Copy link
Member

@gnprice gnprice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Small comments.

// One is muted, one isn't: don't exclude
eg.dmMessage(from: eg.thirdUser, to: [eg.selfUser, eg.otherUser], flags: []),
]);
check(model.countInCombinedFeedNarrow()).equals(2);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the name of the test case, this should be calling countInAllDms, right?

Comment on lines +231 to +235
int countInAllDms() {
int c = 0;
for (final MapEntry(key: narrow, value: messageIds) in dms.entries) {
if (channelStore.shouldMuteDmConversation(narrow)) continue;
c += messageIds.length;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name feels misleading, given that this isn't actually all DMs. 🙂 A bit like how we moved away from "All messages" to "Combined feed".

How about just countInDms? And maybe dartdoc mentioning it excludes muted DM conversations.

Comment on lines +202 to 203
// Exclude because user is muted
eg.dmMessage(from: eg.thirdUser, to: [eg.selfUser], flags: []),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: the muted channel and topic just above don't have comments, so seems clearest not to add one only here

@override
Widget? buildTrailing(BuildContext context) {
final store = PerAccountStoreWidget.of(context);
final unreadCount = store.unreads.countInCombinedFeedNarrow();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I worry a bit about adding this call site given this TODO for #370:

  // TODO(#370): maintain this count incrementally, rather than recomputing from scratch
  int countInCombinedFeedNarrow() {

Do you have any timings on how long this takes with lots of unreads?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see, this is only in the main-menu bottom sheet, not the bottom tabs. In that case I guess it doesn't make the impact any worse than it is now with the mark-as-read button in the message list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration review Added by maintainers when PR may be ready for integration product review Added by maintainers when a PR needs product review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants