From 911cf46c72e8fd65bc835dd40d9dbfc24b7f3dc2 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Thu, 17 Nov 2022 10:09:10 -0800 Subject: [PATCH] unread: Fix mark all as read when oldest unread message is muted. As detailed in the comment, the new "mark all as read" bankrupcty code path would fail to mark as read muted stream messages that are older than the oldest unread non-muted message. This was because of the semantics of the `first_unread` anchor value being actually "fire unmuted unread". We can just change this to "oldest", because we're already using an `is:unread` for the narrow query; doing so likely is a small optimization, since we save the query to compute the first unread. --- static/js/unread_ops.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/static/js/unread_ops.js b/static/js/unread_ops.js index 6e3c238706..2396aeb583 100644 --- a/static/js/unread_ops.js +++ b/static/js/unread_ops.js @@ -23,7 +23,11 @@ let loading_indicator_displayed = false; export function mark_all_as_read(args = {}) { args = { - anchor: "first_unread", + // We use an anchor of "oldest", not "first_unread", because + // "first_unread" will be the oldest non-muted unread message, + // which would result in muted unreads older than the first + // unread not being processed. + anchor: "oldest", include_anchor: true, messages_read_till_now: 0, ...args,