Skip to content

Commit 463e270

Browse files
committed
actions [nfc]: Simplify includeAnchor logic slightly in update-flags loop
By updating the `includeAnchor` local immediately next to where we update the anchor itself, their relationship is made clear without a comment.
1 parent 3fc179a commit 463e270

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lib/widgets/actions.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,7 @@ Future<bool> updateMessageFlagsStartingFromAnchor({
117117
while (true) {
118118
final result = await updateMessageFlagsForNarrow(connection,
119119
anchor: anchor,
120-
// Follow-up requests will have already processed the
121-
// anchor ID, so after the first iteration, this will be
122-
// unconditionally false.
123-
includeAnchor: responseCount == 0 ? includeAnchor : false,
120+
includeAnchor: includeAnchor,
124121
// There is an upper limit of 5000 messages per batch
125122
// (numBefore + numAfter <= 5000) enforced on the server.
126123
// See `update_message_flags_in_narrow` in zerver/views/message_flags.py .
@@ -162,6 +159,7 @@ Future<bool> updateMessageFlagsStartingFromAnchor({
162159
return false;
163160
}
164161
anchor = NumericAnchor(result.lastProcessedId!);
162+
includeAnchor = false;
165163

166164
// The task is taking a while, so tell the user we're working on it.
167165
// TODO: Ideally we'd have a progress widget here that showed up based

0 commit comments

Comments
 (0)