mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
recent_topics: Fix exception processing old deleted messages.
When old messages are deleted, they may not be present in message_store when we receive the event notifying the client about their deletion.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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]);
|
||||
|
||||
Reference in New Issue
Block a user