From 8876179ef7d9545fb9f599444fe847a7cdc764a5 Mon Sep 17 00:00:00 2001 From: Bojidar Marinov Date: Thu, 22 Dec 2016 15:17:56 +0200 Subject: [PATCH] message-edit: Always rerender home view after topic editing. When editing a message changes the current narrow, we rerender the narrowed view earlier in the function, so we don't need to do it here. But we still need to rerender the home view, or the messages will be displayed incorrectly once the user unnarrows! Tweaked by tabbott for clarity and simplicity. Fixes #2464. --- static/js/message_store.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/static/js/message_store.js b/static/js/message_store.js index 248fa16d27..7f4425c40a 100644 --- a/static/js/message_store.js +++ b/static/js/message_store.js @@ -302,14 +302,15 @@ exports.update_messages = function update_messages(events) { alert_words.process_message(msg); }); - // If a topic was edited, we re-render the whole view to get any propagated edits - // to be updated + // If a topic was edited, we re-render the whole view to get any + // propagated edits to be updated (since the topic edits can have + // changed the correct grouping of messages). if (topic_edited) { - if (!changed_narrow) { - home_msg_list.rerender(); - if (current_msg_list === message_list.narrowed) { - message_list.narrowed.rerender(); - } + home_msg_list.rerender(); + // However, we don't need to rerender message_list.narrowed if + // we just changed the narrow earlier in this function. + if (!changed_narrow && current_msg_list === message_list.narrowed) { + message_list.narrowed.rerender(); } } else { home_msg_list.view.rerender_messages(msgs_to_rerender);