mirror of https://github.com/zulip/zulip.git
Don't use all_msg_list to memoize add_message_metadata.
The problem is that if you load a browser window in a stream narrow, add_message_metadata will be called for the messages in the narrowed view before it is called for the messages going into the main view (thus inserting them into all_msg_list), resulting in duplicate copies of messages. This would be mostly OK except that we call process_message_for_recent_subjects inside add_message_metadata, and that function assumes it is only called once on each message (otherwise it'll double-count the message). (imported from commit a3e7f85874100cd93a6d07684605da04d9cc80c7)
This commit is contained in:
parent
7ebd214f89
commit
1df794efdc
|
@ -572,8 +572,9 @@ function process_message_for_recent_subjects(message) {
|
|||
recent_subjects[message.stream] = recents;
|
||||
}
|
||||
|
||||
var msg_metadata_cache = {};
|
||||
function add_message_metadata(message, dummy) {
|
||||
var cached_msg = all_msg_list.get(message.id);
|
||||
var cached_msg = msg_metadata_cache[message.id];
|
||||
if (cached_msg !== undefined) {
|
||||
// Copy the match subject and content over if they exist on
|
||||
// the new message
|
||||
|
@ -639,6 +640,7 @@ function add_message_metadata(message, dummy) {
|
|||
}
|
||||
});
|
||||
|
||||
msg_metadata_cache[message.id] = message;
|
||||
return message;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue