message_list: Clean up API for rerender_after_muting_changes.

This was only called from two places in one function, and we can just
check muting_enabled in the caller.

This refactor is important, because we might need to update muting
after other changes (specifically, message editing to move a topic to
be muted/non-muted).
This commit is contained in:
Tim Abbott 2018-04-27 08:35:02 -07:00
parent 88951d627a
commit 3f736c9b06
2 changed files with 5 additions and 7 deletions

View File

@ -564,11 +564,7 @@ exports.MessageList.prototype = {
}
},
rerender_after_muting_changes: function MessageList_rerender_after_muting_changes() {
if (!this.muting_enabled) {
return;
}
update_muting_and_rerender: function MessageList_update_muting_and_rerender() {
this._items = this.unmuted_messages(this._all_items);
this.rerender();
},

View File

@ -15,9 +15,11 @@ exports.rerender = function () {
// re-doing a mute or unmute is a pretty recoverable thing.
stream_list.update_streams_sidebar();
current_msg_list.rerender_after_muting_changes();
if (current_msg_list.muting_enabled) {
current_msg_list.update_muting_and_rerender();
}
if (current_msg_list !== home_msg_list) {
home_msg_list.rerender_after_muting_changes();
home_msg_list.update_muting_and_rerender();
}
};