mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
narrow: Mark as read in by_recipient
based on case ("dm" or "stream").
In commit #25837, we added in a check for the user's mark as read policy in the frontend for `by_topic` and `by_recipient` narrowing. In that change, the assumption was that for both functions, it was sufficient to check only for whether the user policy was to never mark as read. But because the `by_recipient` function may narrow to an interleaved stream view, it is possible that message will be marked as read when the user did not expect it to be (e.g. they marked all the messages in a topic narrow as unread and then used the `S` key shortcut to navigate back to the stream view) when they have conversation views only as their mark as read policy. Here we move the check for the user's mark as read policy to be in the two cases for `by_recipient` so that the mark as read behavior here matches the user's setting.
This commit is contained in:
committed by
Tim Abbott
parent
daab1d4265
commit
c5fbd3f085
@@ -918,23 +918,32 @@ export function by_recipient(target_id, opts) {
|
||||
// don't use message_lists.current as it won't work for muted messages or for out-of-narrow links
|
||||
const message = message_store.get(target_id);
|
||||
|
||||
if (
|
||||
user_settings.web_mark_read_on_scroll_policy !==
|
||||
web_mark_read_on_scroll_policy_values.never.code
|
||||
) {
|
||||
// We don't check message_list.can_mark_messages_read
|
||||
// here because the target message_list isn't initialized;
|
||||
// but the targeted message is about to be marked read
|
||||
// in the new view.
|
||||
unread_ops.notify_server_message_read(message);
|
||||
}
|
||||
|
||||
switch (message.type) {
|
||||
case "private":
|
||||
if (
|
||||
user_settings.web_mark_read_on_scroll_policy !==
|
||||
web_mark_read_on_scroll_policy_values.never.code
|
||||
) {
|
||||
// We don't check message_list.can_mark_messages_read
|
||||
// here because the target message_list isn't initialized;
|
||||
// but the targeted message is about to be marked read
|
||||
// in the new view.
|
||||
unread_ops.notify_server_message_read(message);
|
||||
}
|
||||
by("dm", message.reply_to, opts);
|
||||
break;
|
||||
|
||||
case "stream":
|
||||
if (
|
||||
user_settings.web_mark_read_on_scroll_policy ===
|
||||
web_mark_read_on_scroll_policy_values.always.code
|
||||
) {
|
||||
// We don't check message_list.can_mark_messages_read
|
||||
// here because the target message_list isn't initialized;
|
||||
// but the targeted message is about to be marked read
|
||||
// in the new view.
|
||||
unread_ops.notify_server_message_read(message);
|
||||
}
|
||||
by("stream", message.stream, opts);
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user