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.
This commit is contained in:
Tim Abbott
2022-11-17 10:09:10 -08:00
parent 16c45aaf42
commit 911cf46c72

View File

@@ -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,