mirror of https://github.com/zulip/zulip.git
31 lines
827 B
JavaScript
31 lines
827 B
JavaScript
const huddle_timestamps = new Map();
|
|
|
|
exports.process_loaded_messages = function (messages) {
|
|
let need_resize = false;
|
|
|
|
for (const message of messages) {
|
|
const huddle_string = people.huddle_string(message);
|
|
|
|
if (huddle_string) {
|
|
const old_timestamp = huddle_timestamps.get(huddle_string);
|
|
|
|
if (!old_timestamp || old_timestamp < message.timestamp) {
|
|
huddle_timestamps.set(huddle_string, message.timestamp);
|
|
need_resize = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
return need_resize;
|
|
};
|
|
|
|
exports.get_huddles = function () {
|
|
let huddles = Array.from(huddle_timestamps.keys());
|
|
huddles = _.sortBy(huddles, function (huddle) {
|
|
return huddle_timestamps.get(huddle);
|
|
});
|
|
return huddles.reverse();
|
|
};
|
|
|
|
window.huddle_data = exports;
|