File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed
Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ abstract final class ZulipAction {
3232 static Future <void > markNarrowAsRead (BuildContext context, Narrow narrow) async {
3333 final zulipLocalizations = ZulipLocalizations .of (context);
3434
35- if (narrow is CombinedFeedNarrow || narrow is ChannelNarrow ) {
35+ if (narrow is CombinedFeedNarrow || narrow is ChannelNarrow || narrow is MentionsNarrow ) {
3636 final didConfirm = showSuggestedActionDialog (context: context,
3737 title: zulipLocalizations.markAllAsReadConfirmationDialogTitle,
3838 message: zulipLocalizations.markAllAsReadConfirmationDialogMessage,
Original file line number Diff line number Diff line change @@ -98,6 +98,29 @@ void main() {
9898 });
9999 });
100100
101+ testWidgets ('MentionsNarrow sends API request when confirme to mark as read' , (tester) async {
102+ const narrow = MentionsNarrow ();
103+ await prepare (tester);
104+ connection.prepare (json: UpdateMessageFlagsForNarrowResult (
105+ processedCount: 2 , updatedCount: 2 ,
106+ firstProcessedId: 1 , lastProcessedId: 2 ,
107+ foundOldest: true , foundNewest: true ).toJson ());
108+ await confirmToMarkNarrowAsRead (tester: tester, context: context, narrow: narrow);
109+ final apiNarrow = narrow.apiEncode ()..add (ApiNarrowIs (IsOperand .unread));
110+ check (connection.lastRequest).isA< http.Request > ()
111+ ..method.equals ('POST' )
112+ ..url.path.equals ('/api/v1/messages/flags/narrow' )
113+ ..bodyFields.deepEquals ({
114+ 'anchor' : 'oldest' ,
115+ 'include_anchor' : 'false' ,
116+ 'num_before' : '0' ,
117+ 'num_after' : '1000' ,
118+ 'narrow' : jsonEncode (resolveApiNarrowForServer (apiNarrow, connection.zulipFeatureLevel! )),
119+ 'op' : 'add' ,
120+ 'flag' : 'read' ,
121+ });
122+ });
123+
101124 testWidgets ('use is:unread optimization' , (tester) async {
102125 const narrow = CombinedFeedNarrow ();
103126 await prepare (tester);
You can’t perform that action at this time.
0 commit comments