mirror of
https://github.com/zulip/zulip.git
synced 2026-06-21 21:32:29 +08:00
recent_senders: Replace topic_senders and stream_senders with IntDict.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
parent
ceb37edb55
commit
21b13e656d
@ -1,16 +1,16 @@
|
||||
const Dict = require('./dict').Dict;
|
||||
const FoldDict = require('./fold_dict').FoldDict;
|
||||
const IntDict = require('./int_dict').IntDict;
|
||||
|
||||
const topic_senders = new Dict(); // key is stream-id, value is Dict
|
||||
const stream_senders = new Dict(); // key is stream-id, value is Dict
|
||||
const topic_senders = new IntDict(); // key is stream-id, value is Dict
|
||||
const stream_senders = new IntDict(); // key is stream-id, value is Dict
|
||||
|
||||
exports.process_message_for_senders = function (message) {
|
||||
const stream_id = message.stream_id.toString();
|
||||
const stream_id = message.stream_id;
|
||||
const topic = util.get_message_topic(message);
|
||||
|
||||
// Process most recent sender to topic
|
||||
const topic_dict = topic_senders.get(stream_id) || new FoldDict();
|
||||
let sender_message_ids = topic_dict.get(topic) || new Dict();
|
||||
let sender_message_ids = topic_dict.get(topic) || new IntDict();
|
||||
let old_message_id = sender_message_ids.get(message.sender_id);
|
||||
|
||||
if (old_message_id === undefined || old_message_id < message.id) {
|
||||
@ -21,7 +21,7 @@ exports.process_message_for_senders = function (message) {
|
||||
topic_senders.set(stream_id, topic_dict);
|
||||
|
||||
// Process most recent sender to whole stream
|
||||
sender_message_ids = stream_senders.get(stream_id) || new Dict();
|
||||
sender_message_ids = stream_senders.get(stream_id) || new IntDict();
|
||||
old_message_id = sender_message_ids.get(message.sender_id);
|
||||
|
||||
if (old_message_id === undefined || old_message_id < message.id) {
|
||||
@ -32,8 +32,6 @@ exports.process_message_for_senders = function (message) {
|
||||
};
|
||||
|
||||
exports.compare_by_recency = function (user_a, user_b, stream_id, topic) {
|
||||
stream_id = stream_id.toString();
|
||||
|
||||
let a_message_id;
|
||||
let b_message_id;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user