-
Notifications
You must be signed in to change notification settings - Fork 373
action: Add dialog to markNarrowAsRead when outside of conversation view #2006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
chrisbobbe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Comments below.
1de2a51 to
970aee6
Compare
|
@chrisbobbe Thanks for reviewing! Squash the 4 commits into one.
|
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 |
1613f50 to
f0bf130
Compare
chrisbobbe
left a comment
There was a problem hiding this 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.
test/widgets/message_list_test.dart
Outdated
| return checkSuggestedActionDialog(tester, | ||
| expectedTitle: zulipLocalizations.markAllAsReadConfirmationDialogTitle, | ||
| expectedMessage: zulipLocalizations.markAllAsReadConfirmationDialogMessage(unreadCount), | ||
| expectDestructiveActionButton: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why expectDestructiveActionButton: true?
There was a problem hiding this comment.
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.
ef8f94f to
a2042c6
Compare
|
Thanks @chrisbobbe! it's ready for another review. |
chrisbobbe
left a comment
There was a problem hiding this 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.
test/widgets/actions_test.dart
Outdated
| 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; | ||
| } |
There was a problem hiding this comment.
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?
fb8131c to
9bdce8a
Compare
f3a1475 to
49caa61
Compare
|
Thanks @chrisbobbe! It's ready for another look. |
|
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 —into just one commit. The first commit is incomplete without the tests and dartdoc updates in the latter two commits. |
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.
49caa61 to
d643776
Compare
gnprice
left a comment
There was a problem hiding this 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.
| actionButtonText: zulipLocalizations.markAllAsReadConfirmationDialogConfirmButton); | ||
|
|
||
| if (await didConfirm.result != true) return; |
There was a problem hiding this comment.
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:
| actionButtonText: zulipLocalizations.markAllAsReadConfirmationDialogConfirmButton); | |
| if (await didConfirm.result != true) return; | |
| actionButtonText: zulipLocalizations.markAllAsReadConfirmationDialogConfirmButton); | |
| if (await didConfirm.result != true) return; |
| }; | ||
|
|
||
| if (shouldShowConfirmationDialog) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: similarly:
| }; | |
| if (shouldShowConfirmationDialog) { | |
| }; | |
| if (shouldShowConfirmationDialog) { |
| final shouldShowConfirmationDialog = switch (narrow) { | ||
| CombinedFeedNarrow() |
There was a problem hiding this comment.
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), |
There was a problem hiding this comment.
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.

Fixes: #1858
Still picture
Screencasts
combined feed narrow
combined_feed_sc.mp4
channel narrow
channel_sc.mp4
mentions narrow
mention_sc.mp4