Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
unread_ops: Hide unread banner after marking msgs read.
Aman Agrawale285711abf30
diff --git a/web/src/unread_ops.ts b/web/src/unread_ops.tsindex 8dda33c74da..b9d54b075e8 100644--- a/web/src/unread_ops.ts+++ b/web/src/unread_ops.ts@@ -10,6 +10,7 @@ import * as channel from "./channel.ts";import * as confirm_dialog from "./confirm_dialog.ts";import * as desktop_notifications from "./desktop_notifications.ts";import * as dialog_widget from "./dialog_widget.ts";+import {Filter} from "./filter.ts";import {$t_html} from "./i18n.ts";import * as loading from "./loading.ts";import * as message_flags from "./message_flags.ts";@@ -200,6 +201,29 @@ function bulk_update_read_flags_for_narrow(if (caller_modal_id) {modals.close_if_open(caller_modal_id);}++ // We just marked all the messages in this narrow as read.+ // Hide the unread banner and resume reading if possible.+ //+ // We exclude the `is:unread` term that was included+ // by the caller for checking whether weot re-enable+ // resume-reading.+ //+ // TODO: Ideally, we'd change the calling convention+ // to avoid this hacky code, which may behave+ // incorrectly for some `is:unread` search views.+ const filter_terms = narrow.filter(+ (term) =>+ !(+ term.operator === "is" &&+ term.operand === "unread" &&+ term.negated === false+ ),+ );+ if (message_lists.current?.data.filter.equals(new Filter(filter_terms))) {+ message_lists.current?.resume_reading();+ unread_ui.hide_unread_banner();+ }}},error(xhr) {