diff --git a/static/js/recent_senders.js b/static/js/recent_senders.js index c3e98bd4e3..a85e1de925 100644 --- a/static/js/recent_senders.js +++ b/static/js/recent_senders.js @@ -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;