Skip to content

Conversation

@chungwwei
Copy link
Contributor

@chungwwei chungwwei commented Nov 25, 2025

Fixes: #1858

Still picture
narrow tap when long press
Screenshot_1765549260 Screenshot_1765549453
Screencasts

combined feed narrow

combined_feed_sc.mp4

channel narrow

channel_sc.mp4

mentions narrow

mention_sc.mp4

@gnprice gnprice added the maintainer review PR ready for review by Zulip maintainers label Nov 25, 2025
Copy link
Collaborator

@chrisbobbe chrisbobbe left a comment

Choose a reason for hiding this comment

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

Thanks! Comments below.

@chungwwei chungwwei force-pushed the read-confirm-dialog branch from 1de2a51 to 970aee6 Compare December 2, 2025 21:19
@chungwwei
Copy link
Contributor Author

@chrisbobbe Thanks for reviewing!

Squash the 4 commits into one.

KeywordSearchNarrow was the other narrow. Was not looking at the code, but when i tested in the app, the Mark all messages as read button didn't appear in the search view when searched. Would you be okay with me filing a follow up issue for KeywordSearchNarrow?

@chungwwei chungwwei requested a review from chrisbobbe December 2, 2025 21:33
@chrisbobbe
Copy link
Collaborator

chrisbobbe commented Dec 2, 2025

KeywordSearchNarrow was the other narrow.

That's not accurate. We should show the dialog when the narrow is not a conversation narrow. A "conversation narrow" is a topic narrow or a DM narrow; see e.g. the top of the Zulip Help Center "Reading conversations" article. These details are provided for you in the issue description and discussions linked from there.

In the zulip-flutter codebase, there are multiple kinds of Narrow other than TopicNarrow and DmNarrow. CombinedFeedNarrow and KeywordSearchNarrow are just two of those.

Copy link
Collaborator

@chrisbobbe chrisbobbe left a comment

Choose a reason for hiding this comment

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

Thanks! Comments below.

Since the issue is about the mark-as-read button at the bottom of the message list, I'd like to have some tests in the 'MarkAsReadWidget' group in test/widgets/message_list_test.dart that explicitly target the behavior. (I see you've already made some changes to existing tests there, basically as needed to make them pass.)

How about a new group('confirmation dialog', () {}); inside the 'MarkAsReadWidget' group, with tests like these:

  • test('CombinedFeedNarrow: show dialog', () {});
  • test('MentionsNarrow: show dialog', () {});
  • test('ChannelNarrow: show dialog', () {});
  • test('DmNarrow: do not show dialog', () {});
  • test('TopicNarrow: do not show dialog', () {});

For the 'do not show dialog' tests, you should be able to use the checkNoDialog helper in test/widgets/dialog_checks.dart.

return checkSuggestedActionDialog(tester,
expectedTitle: zulipLocalizations.markAllAsReadConfirmationDialogTitle,
expectedMessage: zulipLocalizations.markAllAsReadConfirmationDialogMessage(unreadCount),
expectDestructiveActionButton: true,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why expectDestructiveActionButton: true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Set to false. Read can be reverted.

@chrisbobbe
Copy link
Collaborator

(I've also just filed #2030 and #2031 for future work, but those are out of scope for this PR; I don't expect them to require changes here. 🙂)

@chungwwei chungwwei force-pushed the read-confirm-dialog branch 8 times, most recently from ef8f94f to a2042c6 Compare December 12, 2025 14:34
@chungwwei
Copy link
Contributor Author

Thanks @chrisbobbe! it's ready for another review.

@chungwwei chungwwei requested a review from chrisbobbe December 12, 2025 15:01
Copy link
Collaborator

@chrisbobbe chrisbobbe 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 below.

Comment on lines 69 to 78
Future<void> confirmToMarkNarrowAsRead({required WidgetTester tester,
required BuildContext context, required Narrow narrow, required int unreadCount,
}) async {
final future = ZulipAction.markNarrowAsRead(context, narrow);
await tester.pump(); // confirmation dialog appears
final (confirmButton, _) = checkConfirmDialog(tester, unreadCount);
await tester.tap(find.byWidget(confirmButton));
await tester.pump(Duration.zero); // wait through API request
await future;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Bump on #2006 (comment) .

…Ah, I think maybe my meaning wasn't clear: I want to keep the checkConfirmDialog helper function, but not this confirmToMarkNarrowAsRead helper. Can you remove it please?

@chungwwei chungwwei force-pushed the read-confirm-dialog branch 3 times, most recently from fb8131c to 9bdce8a Compare December 16, 2025 21:55
@chungwwei chungwwei force-pushed the read-confirm-dialog branch 2 times, most recently from f3a1475 to 49caa61 Compare December 16, 2025 22:27
@chungwwei chungwwei requested a review from chrisbobbe December 16, 2025 22:37
@chungwwei
Copy link
Contributor Author

Thanks @chrisbobbe! It's ready for another look.

@chungwwei chungwwei changed the title action: Add dialog to markNarrowAsRead for CombinedFeedNarrow view action: Add dialog to markNarrowAsRead when outside of conversation view Dec 16, 2025
@chrisbobbe
Copy link
Collaborator

Thanks! LGTM; marking for Greg's review.

One small request that would make reviewing just a bit easier for us 🙂:

  • If it's not my first review, I'll start by looking at each comment from my previous review, to check that it's resolved.
  • If you've used GitHub's "resolve comment" feature on those comments, then I have to click "Show resolved" on each one, which makes this part take longer than it would otherwise: image
  • On the other hand, it's helpful for you to have a way to track which comments you've responded to 🙂. The 👍 reaction works well for that.
  • So, please feel free to add the 👍 reaction to my review comments, to help you track your progress, but please don't use GitHub's "resolve comment" feature.

@chrisbobbe chrisbobbe requested a review from gnprice December 17, 2025 00:16
@chrisbobbe chrisbobbe 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 Dec 17, 2025
@chrisbobbe
Copy link
Collaborator

chrisbobbe commented Dec 17, 2025

Ah and one comment I've been meaning to make, and almost forgot again: please squash this revision's three commits—

169ad4c actions: Add markNarrowAsRead dialog outside conversation views
07a56a7 msglist test: Verify whether the MarkNarrowAsRead dialog appears
49caa61 actions: Update dartdoc for markNarrowAsRead func

—into just one commit. The first commit is incomplete without the tests and dartdoc updates in the latter two commits.

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 @chungwwei, and thanks @chrisbobbe for the previous reviews!

Comments below. I haven't yet fully read the tests, but I've read the other changes.

One commit-message nit:

Fixes: #1858.

This should read "Fixes #1858.", no colon, at the beginning. (Also acceptable would be "Fixes: #1858", no period, at the end.) See examples: take a look at our Git history, following our guide.

Comment on lines 52 to 54
actionButtonText: zulipLocalizations.markAllAsReadConfirmationDialogConfirmButton);

if (await didConfirm.result != true) return;
Copy link
Member

Choose a reason for hiding this comment

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

nit: these are tightly related; join visually as one stanza:

Suggested change
actionButtonText: zulipLocalizations.markAllAsReadConfirmationDialogConfirmButton);
if (await didConfirm.result != true) return;
actionButtonText: zulipLocalizations.markAllAsReadConfirmationDialogConfirmButton);
if (await didConfirm.result != true) return;

Comment on lines 45 to 48
};

if (shouldShowConfirmationDialog) {
Copy link
Member

Choose a reason for hiding this comment

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

nit: similarly:

Suggested change
};
if (shouldShowConfirmationDialog) {
};
if (shouldShowConfirmationDialog) {

Comment on lines +38 to +41
final shouldShowConfirmationDialog = switch (narrow) {
CombinedFeedNarrow()
Copy link
Member

Choose a reason for hiding this comment

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

Let's include a comment linking to our thinking for what sort of narrows should get this behavior:
https://chat.zulip.org/#narrow/channel/48-mobile/topic/mark.20all.20messages.20as.20read/near/2261768

That way, when we add more types of narrows in the future, it will help us make the decision of whether the new narrows should get this behavior or not.

final unreadCount = store.unreads.countInNarrow(narrow);
final didConfirm = showSuggestedActionDialog(context: context,
title: zulipLocalizations.markAllAsReadConfirmationDialogTitle,
message: zulipLocalizations.markAllAsReadConfirmationDialogMessage(unreadCount),
Copy link
Member

Choose a reason for hiding this comment

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

The issue calls for some nontrivial nuances in how this text interacts with the number of known unread messages. Would you try implementing those nuances?

If part of the spec isn't included in what the PR implements, that always needs to be highlighted in the PR. Then we can decide whether to leave it for later, and can make sure to track the follow-up task.

A confirm ActionDialog is added to prevent accidentally marking many
messages as read outside conversation views.

Also, adjust existing MarkAsReadWidget tests and
MarkChannelAsReadButton tests to account for the added confirmation
dialog.

Fixes: zulip#1858
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Get confirmation before marking an interleaved feed as unread

3 participants