-
Notifications
You must be signed in to change notification settings - Fork 309
action_sheet: Add "Mark as unread from here" button #779
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
Conversation
f6e803a
to
fa7c150
Compare
Mark as unread from here
button
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 @Khader-1 for this. A few comments below.
Also, I would write the commit message as such:
action_sheet: Add "Mark as unread from here" button
Using `` is usually used for distinguishing code-related words from the rest of the commit message.
Mark as unread from here
buttonThere 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.
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.
lgtm
@Khader-1 , as usual, please add screenshots of all UI changes to the PR description, in addition to any videos. |
Thanks! Putting the new option just between "Quote and reply" and "Copy message text" would be most consistent with the web app UI, so let's do that. When an issue doesn't specify where to put a new option, you can go ahead and flag it for discussion. |
We might need to figure out how to organize that menu soon -- it's getting long already, and there's more to come. :) |
Thanks @alya! I've just reordered the list.
Maybe consider filing an issue to track this? I'm happy to work on any reordering or restructuring that may be needed. Additionally, I've rebased back onto the main branch since #811 was merged. |
ce72213
to
a5525e7
Compare
Thanks for the catch @PIG208! I've just pushed a new revision PTAL. |
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 @Khader-1, and thanks @sm-sayedi @alya @kenclary @PIG208 for the previous reviews!
I've read through the first few commits:
f2dec7f actions [nfc]: Port generic error handling to markNarrowAsRead
d4d2615 actions [nfc]: Port handleAllMessagesReadSuccess
to markNarrowAsRead
45a5702 actions [nfc]: Move legacy-server check inside markNarrowAsRead
Generally they look good — thanks for completing those refactors. Going AFK for a bit, so here's the comments I have on those.
Later I'll return and review the remaining commits:
4793beb actions [nfc]: Factor out updateMessageFlagsStartingFromAnchor
7594536 actions_test [nfc]: Remove unnecessary whitespace
337451a actions_test: Create updateMessageFlagsStartingFromAnchor
test group
680d491 actions_test [nfc]: Move generic cases out of markNarrowAsRead
4a86408 actions_test [nfc]: Use updateMessageFlagsStartingFromAnchor in it's cases
a5525e7 action_sheet: Add "Mark as unread from here" button
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.
OK, finished reading the branch — comments on the remaining commits below.
I'll also want to make a pass over the commit structure and comments; but that'll be relatively quick once these items are addressed.
a5525e7
to
3fc179a
Compare
Thanks @gnprice! I've pushed a new revision PTAL. |
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 for the revision! Just nits below, and I've also pushed a few added commits on the end:
463e270 actions [nfc]: Simplify includeAnchor logic slightly in update-flags loop
4f6283e actions [nfc]: Simplify name of anchor parameter to update-flags
fab52ef actions [nfc]: Revise doc comment for updateMessageFlagsStartingFromAnchor
After fixing those nits, this will be ready to merge.
@@ -16,101 +16,174 @@ import '../model/narrow.dart'; | |||
import 'dialog.dart'; | |||
import 'store.dart'; | |||
|
|||
Future<void> markNarrowAsRead( |
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: see previous commits for what summary-line prefixes are used on a given file, and match those
msg_list: Ensure markNarrowAsRead passes before acting on it
See https://github.com/zulip/zulip-mobile/blob/main/docs/howto/git.md for tips on reading history, including filtering to changes touching a file.
test/widgets/action_sheet_test.dart
Outdated
@@ -542,4 +544,63 @@ void main() { | |||
check(mockSharePlus.sharedString).isNull(); | |||
}); | |||
}); | |||
|
|||
group('MarkAsUnread', () { |
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: tests in same order as code under test, to keep it easy to navigate each file from code in the other
test/widgets/actions_test.dart
Outdated
check(await didPass).isTrue(); | ||
}); | ||
|
||
testWidgets('pagination', (WidgetTester tester) async { |
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.
commit-structure nit:
2370dee actions_test [nfc]: Move generic cases out of markNarrowAsRead
69bd093 actions_test [nfc]: Use updateMessageFlagsStartingFromAnchor in it's cases
These are best squashed together — that way we don't have an intermediate state where there are tests that are described as being about updateMessageFlagsStartingFromAnchor but actually invoke markNarrowAsRead. Compare d439e65, where I moved tests from MarkAsReadWidget to markNarrowAsRead.
Similarly this previous commit can be squashed in:
c4fee15 actions_test [nfc]: Create updateMessageFlagsStartingFromAnchor test group
And then this previous commit may as well be squashed in too:
f37e338 actions_test [nfc]: Remove unnecessary whitespace
since those other changes are rearranging the list of test cases, and that one is a slight formatting fix to the same list.
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 this part:
Similarly this previous commit can be squashed in:
c4fee15 actions_test [nfc]: Create updateMessageFlagsStartingFromAnchor test group
fab52ef
to
1596022
Compare
Thanks @gnprice! I've pushed a new revision PTAL. |
1 similar comment
Thanks @gnprice! I've pushed a new revision PTAL. |
cfdbddf
to
eafb710
Compare
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 @Khader-1 for the revision! Two comments below.
I think these will both be fastest for me to just fix up, so I'll do that and merge. But please do take a look through the material about handling Git merge/rebase conflicts and about git range-diff
.
test/widgets/action_sheet_test.dart
Outdated
@@ -385,6 +387,65 @@ void main() { | |||
}); | |||
}); | |||
|
|||
group('MarkAsUnread', () { | |||
testWidgets('not visible if message is not read', (WidgetTester tester) async { |
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.
testWidgets('not visible if message is not read', (WidgetTester tester) async { | |
testWidgets('not visible if message is not read', (tester) async { |
That's a change that happened in main, so this looks like an error in merge-conflict resolution. I think the demo I did of those was one of the weeks you weren't able to join the call; but I recommend taking a look at these threads which have much the same information:
https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/rebase.20conflicts/near/1895505
https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/rebase.20conflicts/near/1136429
https://chat.zulip.org/#narrow/stream/2-general/topic/navigating.20code.20review.3A.20Rebasing.20work/near/1737371
See also this discussion of git range-diff
:
https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/code.20reviews/near/1852971
That's in the context of reviewing someone else's PR (for comparing a new revision to a revision I previously reviewed), but I also regularly use it for self-review. In its output comparing your old revision to this revision, you'll see:
-- testWidgets('pagination', (WidgetTester tester) async {
+- testWidgets('pagination', (tester) async {
- // Check that `lastProcessedId` returned from an initial
- // response is used as `anchorId` for the subsequent request.
- final narrow = TopicNarrow.ofMessage(eg.streamMessage());
and later
+ testWidgets('pagination', (WidgetTester tester) async {
+ // Check that `lastProcessedId` returned from an initial
+ // response is used as `anchorId` for the subsequent request.
-+ final narrow = TopicNarrow.ofMessage(eg.streamMessage());
+ await prepare(tester);
Or it's a bit clearer with its red and green colors:
Note the change in the red side of the code from WidgetTester tester
to just tester
, and the absence of a corresponding change in the green side of the code. That's how I noticed this in this review.
test/widgets/actions_test.dart
Outdated
check(await didPass).isTrue(); | ||
}); | ||
|
||
testWidgets('pagination', (WidgetTester tester) async { |
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 this part:
Similarly this previous commit can be squashed in:
c4fee15 actions_test [nfc]: Create updateMessageFlagsStartingFromAnchor test group
Most of the logic in `markNarrowAsRead` is not specific to marking narrow as read, rather it is actually updating message flags for the narrow starting from the oldest anchor. As we are going to use this logic for several other actions starting with the next commit, it is better to have that generic logic factored out and reused.
…FlagsStartingFromAnchor
…loop By updating the `includeAnchor` local immediately next to where we update the anchor itself, their relationship is made clear without a comment.
From the perspective of the callers, this anchor works just like the "anchor" parameters anywhere else, including the Zulip server API endpoints that take an anchor and narrow: the function operates on messages starting from there. The fact that it does so with potentially multiple server API calls, each with a different anchor, is an implementation detail. So we can just call the parameter "anchor".
eafb710
to
4e25bc8
Compare
Fixes: #131
This adds a new button "Mark as unread from here" to the bottom sheet activated for read messages, when clicked all messages starting from selected one down are marked as unread.
Simulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2024-07-11.at.13.25.34.mp4