inbox: Call update from unread_ui.update_unread_counts.

Fixes #26687

This seems work correctly after manually testing all the events
for which inbox_ui.update was previously called.
This commit is contained in:
Aman Agrawal 2023-09-24 06:26:57 +00:00 committed by Tim Abbott
parent 61f602ed73
commit ede7f62781
7 changed files with 5 additions and 17 deletions

View File

@ -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();
}

View File

@ -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();

View File

@ -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) {

View File

@ -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":

View File

@ -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});
}

View File

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

View File

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