Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

recent_topics: Fix exception processing old deleted messages.

Tim Abbott5142bdd31771
diff --git a/static/js/recent_senders.js b/static/js/recent_senders.js
index bd24a6e06e8..77239aefdb7 100644
--- a/static/js/recent_senders.js
+++ b/static/js/recent_senders.js
@@ -76,8 +76,13 @@ exports.process_topic_edit = function (old_stream_id, old_topic, new_topic, new_
exports.update_topics_of_message_ids = function (message_ids) {
const topics_to_update = new Map();
for (const msg_id of message_ids) {
- // Note: message_store retians data of msg post deletion.
+ // message_store still has data on deleted messages when this runs.
const message = message_store.get(msg_id);
+ if (message === undefined) {
+ // We may not have the deleted message cached locally in
+ // message_store; if so, we can just skip processing it.
+ continue;
+ }
if (message.type === "stream") {
// Create unique keys for stream_id and topic.
const topic_key = message.stream_id + ":" + message.topic;
diff --git a/static/js/recent_topics.js b/static/js/recent_topics.js
index 3019a387218..f699aa4ef51 100644
--- a/static/js/recent_topics.js
+++ b/static/js/recent_topics.js
@@ -238,6 +238,11 @@ exports.update_topics_of_message_ids = function (message_ids) {
const topics_to_rerender = new Map();
for (const msg_id of message_ids) {
const message = message_store.get(msg_id);
+ if (message === undefined) {
+ // We may not have the deleted message cached locally in
+ // message_store; if so, we can just skip processing it.
+ continue;
+ }
if (message.type === "stream") {
const topic_key = get_topic_key(message.stream_id, message.topic);
topics_to_rerender.set(topic_key, [message.stream_id, message.topic]);