mirror of
https://github.com/zulip/zulip.git
synced 2025-11-07 07:23:22 +00:00
Chop subjects to max of 5 regardless of timestamp of incoming messages
(imported from commit a58cd25d9c129729e0eb42ae090f4c715b5e20fe)
This commit is contained in:
@@ -467,6 +467,7 @@ var update_recent_subjects = $.debounce(100, ui.update_recent_subjects);
|
||||
|
||||
function process_message_for_recent_subjects(message) {
|
||||
var current_timestamp = 0;
|
||||
var max_subjects = 5;
|
||||
|
||||
if (! recent_subjects.hasOwnProperty(message.display_recipient)) {
|
||||
recent_subjects[message.display_recipient] = [];
|
||||
@@ -482,10 +483,6 @@ function process_message_for_recent_subjects(message) {
|
||||
}
|
||||
|
||||
var recents = recent_subjects[message.display_recipient];
|
||||
if (recents.length >= 5 && message.timestamp > recents[4].timestamp) {
|
||||
recents = recents.slice(0, recents.length - 1);
|
||||
}
|
||||
|
||||
recents.push({subject: message.subject,
|
||||
timestamp: Math.max(message.timestamp, current_timestamp)});
|
||||
|
||||
@@ -493,6 +490,8 @@ function process_message_for_recent_subjects(message) {
|
||||
return b.timestamp - a.timestamp;
|
||||
});
|
||||
|
||||
recents = recents.slice(0, max_subjects);
|
||||
|
||||
recent_subjects[message.display_recipient] = recents;
|
||||
update_recent_subjects();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user