refactor: Rename MessageList.update_muting_and_rerender.

This is a prep commit for implementing mute users feature, which
renames this function to be more specific.  This function cannot be
used as-is for user mutes, because for user-muted messages, we always
want to rerender the message list, irrespective of what
`excludes_muted_users` is.

In muting_ui.js, we also remove an unnecessary conditional that is
already handled by update_topic_muting_and_rerender itself.
This commit is contained in:
Abhijeet Prasad Bodas 2021-03-27 16:07:31 +05:30 committed by Tim Abbott
parent f725711ff2
commit 3a9dfc02e6
3 changed files with 8 additions and 11 deletions

View File

@ -401,11 +401,11 @@ export function update_messages(events) {
// propagated edits to be updated (since the topic edits can have
// changed the correct grouping of messages).
if (topic_edited || stream_changed) {
message_lists.home.update_muting_and_rerender();
message_lists.home.update_topic_muting_and_rerender();
// However, we don't need to rerender message_list.narrowed if
// we just changed the narrow earlier in this function.
if (!changed_narrow && message_lists.current === message_list.narrowed) {
message_list.narrowed.update_muting_and_rerender();
message_list.narrowed.update_topic_muting_and_rerender();
}
} else {
// If the content of the message was edited, we do a special animation.

View File

@ -379,13 +379,12 @@ export class MessageList {
}
}
update_muting_and_rerender() {
if (!this.excludes_muted_topics) {
return;
}
update_topic_muting_and_rerender() {
if (this.excludes_muted_topics) {
this.data.update_items_for_muting();
this.rerender();
}
}
all_messages() {
return this.data.all_messages();

View File

@ -32,11 +32,9 @@ export function rerender_on_topic_update() {
stream_list.update_streams_sidebar();
recent_topics.complete_rerender();
if (message_lists.current.excludes_muted_topics) {
message_lists.current.update_muting_and_rerender();
}
message_lists.current.update_topic_muting_and_rerender();
if (message_lists.current !== message_lists.home) {
message_lists.home.update_muting_and_rerender();
message_lists.home.update_topic_muting_and_rerender();
}
if (overlays.settings_open() && settings_muting.loaded) {
set_up_muted_topics_ui();