mirror of
https://github.com/zulip/zulip.git
synced 2025-11-13 02:17:19 +00:00
js: Fix dependency cycle in unread.js.
The import of recent_topics_ui.js from unread.js generates an import loop. To remove this, we need to move the logic for rerendering recent topics after update_message_for_mention out of the low-level unread.js data module. Since the logic was conditional on `content_edited` being true, and that parameter is only passed in the message_events.js code path, we can do this by just making the function return a boolean for whether this rerender may be required, and moving the rerender logic to that calling module.
This commit is contained in:
committed by
Tim Abbott
parent
b46e7ef78e
commit
2c30bbbf74
@@ -23,6 +23,7 @@ import {page_params} from "./page_params";
|
||||
import * as pm_list from "./pm_list";
|
||||
import * as recent_senders from "./recent_senders";
|
||||
import * as recent_topics_ui from "./recent_topics_ui";
|
||||
import * as recent_topics_util from "./recent_topics_util";
|
||||
import * as stream_list from "./stream_list";
|
||||
import * as stream_topic_history from "./stream_topic_history";
|
||||
import * as sub_store from "./sub_store";
|
||||
@@ -225,7 +226,10 @@ export function update_messages(events) {
|
||||
msg.raw_content = event.content;
|
||||
}
|
||||
|
||||
unread.update_message_for_mention(msg, any_message_content_edited);
|
||||
if (unread.update_message_for_mention(msg, any_message_content_edited)) {
|
||||
const topic_key = recent_topics_util.get_topic_key(msg.stream_id, msg.topic);
|
||||
recent_topics_ui.inplace_rerender(topic_key);
|
||||
}
|
||||
|
||||
// new_topic will be undefined if the topic is unchanged.
|
||||
const new_topic = util.get_edit_event_topic(event);
|
||||
|
||||
Reference in New Issue
Block a user