diff --git a/web/src/message_events.js b/web/src/message_events.js index 5ab3de77d5..0a0077d519 100644 --- a/web/src/message_events.js +++ b/web/src/message_events.js @@ -9,7 +9,6 @@ import * as compose_state from "./compose_state"; import * as compose_validate from "./compose_validate"; import * as drafts from "./drafts"; import * as huddle_data from "./huddle_data"; -import * as inbox_ui from "./inbox_ui"; import * as message_edit from "./message_edit"; import * as message_edit_history from "./message_edit_history"; import * as message_helper from "./message_helper"; @@ -166,7 +165,6 @@ export function insert_new_messages(messages, sent_by_this_client) { stream_list.update_streams_sidebar(); pm_list.update_private_messages(); recent_view_ui.process_messages(messages); - inbox_ui.update(); } export function update_messages(events) { @@ -239,7 +237,6 @@ export function update_messages(events) { anchor_message.topic, ); recent_view_ui.inplace_rerender(topic_key); - inbox_ui.update(); } } @@ -514,7 +511,6 @@ export function update_messages(events) { }); unread.clear_and_populate_unread_mention_topics(); recent_view_ui.process_topic_edit(...args); - inbox_ui.update(); } // Rerender "Message edit history" if it was open to the edited message. @@ -575,7 +571,6 @@ export function remove_messages(message_ids) { } recent_senders.update_topics_of_deleted_message_ids(message_ids); recent_view_ui.update_topics_of_deleted_message_ids(message_ids); - inbox_ui.update(); starred_messages.remove(message_ids); starred_messages_ui.rerender_ui(); } diff --git a/web/src/message_fetch.js b/web/src/message_fetch.js index 1b1eed1027..92c4e0d73a 100644 --- a/web/src/message_fetch.js +++ b/web/src/message_fetch.js @@ -4,7 +4,6 @@ import {all_messages_data} from "./all_messages_data"; import * as channel from "./channel"; import {Filter} from "./filter"; import * as huddle_data from "./huddle_data"; -import * as inbox_ui from "./inbox_ui"; import * as message_feed_loading from "./message_feed_loading"; import * as message_feed_top_notices from "./message_feed_top_notices"; import * as message_helper from "./message_helper"; @@ -54,7 +53,6 @@ function process_result(data, opts) { huddle_data.process_loaded_messages(messages); recent_view_ui.process_messages(messages); - inbox_ui.update(); stream_list.update_streams_sidebar(); stream_list.maybe_scroll_narrow_into_view(); diff --git a/web/src/muted_users_ui.js b/web/src/muted_users_ui.js index 7a537936f3..8a81019d40 100644 --- a/web/src/muted_users_ui.js +++ b/web/src/muted_users_ui.js @@ -4,7 +4,6 @@ import * as activity from "./activity"; import * as channel from "./channel"; import * as confirm_dialog from "./confirm_dialog"; import {$t_html} from "./i18n"; -import * as inbox_ui from "./inbox_ui"; import * as message_lists from "./message_lists"; import * as muted_users from "./muted_users"; import * as overlays from "./overlays"; @@ -59,7 +58,10 @@ export function rerender_for_muted_user() { // If a user is (un)muted, we want to update their avatars on the Recent Conversations // participants column. recent_view_ui.complete_rerender(); - inbox_ui.update(); + // In theory, we might need to do inbox_ui.update here. But + // because muting a user marks every message the user has sent as + // read, it will update the inbox UI, if necessary through that + // mechanism. } export function handle_user_updates(muted_user_ids) { diff --git a/web/src/stream_events.js b/web/src/stream_events.js index 2b7fb2bfb3..eb290a043a 100644 --- a/web/src/stream_events.js +++ b/web/src/stream_events.js @@ -4,7 +4,6 @@ import * as blueslip from "./blueslip"; import * as color_data from "./color_data"; import * as compose_fade from "./compose_fade"; import * as compose_recipient from "./compose_recipient"; -import * as inbox_ui from "./inbox_ui"; import * as message_lists from "./message_lists"; import * as message_view_header from "./message_view_header"; import * as narrow_state from "./narrow_state"; @@ -56,7 +55,6 @@ export function update_property(stream_id, property, value, other_values) { stream_muting.update_is_muted(sub, value); stream_list.refresh_muted_or_unmuted_stream(sub); recent_view_ui.complete_rerender(); - inbox_ui.update(); break; case "desktop_notifications": case "audible_notifications": diff --git a/web/src/ui_init.js b/web/src/ui_init.js index de6388943c..e02c4d58aa 100644 --- a/web/src/ui_init.js +++ b/web/src/ui_init.js @@ -492,6 +492,7 @@ function initialize_unread_ui() { unread_ui.register_update_unread_counts_hook((counts) => notifications.update_unread_counts(counts), ); + unread_ui.register_update_unread_counts_hook(inbox_ui.update); unread_ui.initialize({notify_server_messages_read: unread_ops.notify_server_messages_read}); } diff --git a/web/src/unread_ops.js b/web/src/unread_ops.js index 2871566da5..9ea902e50c 100644 --- a/web/src/unread_ops.js +++ b/web/src/unread_ops.js @@ -7,7 +7,6 @@ import * as channel from "./channel"; import * as confirm_dialog from "./confirm_dialog"; import * as dialog_widget from "./dialog_widget"; import {$t_html} from "./i18n"; -import * as inbox_ui from "./inbox_ui"; import * as loading from "./loading"; import * as message_flags from "./message_flags"; import * as message_lists from "./message_lists"; @@ -168,7 +167,6 @@ function process_newly_read_message(message, options) { } notifications.close_notification(message); recent_view_ui.update_topic_unread_count(message); - inbox_ui.update(); } export function mark_as_unread_from_here( @@ -312,7 +310,6 @@ export function process_read_messages_event(message_ids) { } unread_ui.update_unread_counts(); - inbox_ui.update(); } export function process_unread_messages_event({message_ids, message_details}) { @@ -389,7 +386,6 @@ export function process_unread_messages_event({message_ids, message_details}) { } unread_ui.update_unread_counts(); - inbox_ui.update(); } // Takes a list of messages and marks them as read. diff --git a/web/src/user_topics_ui.js b/web/src/user_topics_ui.js index 73dd2ada21..e115542a55 100644 --- a/web/src/user_topics_ui.js +++ b/web/src/user_topics_ui.js @@ -1,6 +1,5 @@ import $ from "jquery"; -import * as inbox_ui from "./inbox_ui"; import * as message_lists from "./message_lists"; import * as overlays from "./overlays"; import * as popover_menus from "./popover_menus"; @@ -26,7 +25,6 @@ export function handle_topic_updates(user_topic_event) { user_topic_event.stream_id, user_topic_event.topic_name, ); - inbox_ui.update(); if (overlays.settings_open() && settings_user_topics.loaded) { const stream_id = user_topic_event.stream_id;