Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
emoji_frequency: Ignore uncached messages on deletion events.
apoorvapendsecc57fd4dd280
diff --git a/web/src/emoji_frequency.ts b/web/src/emoji_frequency.tsindex c957954aa28..ae828514c73 100644--- a/web/src/emoji_frequency.ts+++ b/web/src/emoji_frequency.ts@@ -125,6 +125,13 @@ export function update_emoji_frequency_on_remove_reaction_event(export function update_emoji_frequency_on_messages_deletion(message_ids: number[]): void {for (const message_id of message_ids) {const message = message_store.get(message_id);+ // It's normal to receive events about the deletion of+ // messages that this client doesn't have locally cached. No+ // action is required, since only messages that are locally+ // cached are represented in our emoji frequency data.+ if (message === undefined) {+ continue;+ }assert(message !== undefined);const message_reactions = message.clean_reactions.values();for (const emoji of message_reactions) {diff --git a/web/src/server_events_dispatch.js b/web/src/server_events_dispatch.jsindex abf5ee7ffe7..9aaaf468739 100644--- a/web/src/server_events_dispatch.js+++ b/web/src/server_events_dispatch.js@@ -174,9 +174,9 @@ export function dispatch_normal_event(event) {// which returns all the unread messages out of a given list.// So double marking something as read would not occurunread_ops.process_read_messages_event(msg_ids);+ emoji_frequency.update_emoji_frequency_on_messages_deletion(msg_ids);// This methods updates message_list too and since stream_topic_history relies on it// this method should be called first.- emoji_frequency.update_emoji_frequency_on_messages_deletion(msg_ids);message_events.remove_messages(msg_ids);if (event.message_type === "stream") {