diff --git a/frontend_tests/node_tests/unread.js b/frontend_tests/node_tests/unread.js index c269cc698d..10d61febfc 100644 --- a/frontend_tests/node_tests/unread.js +++ b/frontend_tests/node_tests/unread.js @@ -8,6 +8,7 @@ zrequire('unread'); zrequire('settings_notifications'); const Dict = zrequire('dict').Dict; const FoldDict = zrequire('fold_dict').FoldDict; +const IntDict = zrequire('int_dict').IntDict; set_global('page_params', {}); set_global('blueslip', {}); @@ -36,8 +37,8 @@ const zero_counts = { private_message_count: 0, home_unread_messages: 0, mentioned_message_count: 0, - stream_count: new Dict(), - topic_count: new Dict(), + stream_count: new IntDict(), + topic_count: new IntDict(), pm_count: new Dict(), }; diff --git a/static/js/unread.js b/static/js/unread.js index 8373f5be97..ac5c0b6d3a 100644 --- a/static/js/unread.js +++ b/static/js/unread.js @@ -1,5 +1,6 @@ const Dict = require('./dict').Dict; const FoldDict = require('./fold_dict').FoldDict; +const IntDict = require('./int_dict').IntDict; // See https://zulip.readthedocs.io/en/latest/subsystems/pointer.html for notes on // how this system is designed. @@ -276,16 +277,12 @@ exports.unread_topic_counter = (function () { return new FoldDict(); } - function num_dict() { - // Use this for stream ids. - return new Dict(); - } self.get_counts = function () { const res = {}; res.stream_unread_messages = 0; - res.stream_count = num_dict(); // hash by stream_id -> count - res.topic_count = num_dict(); // hash of hashes (stream_id, then topic -> count) + res.stream_count = new IntDict(); // hash by stream_id -> count + res.topic_count = new IntDict(); // hash of hashes (stream_id, then topic -> count) bucketer.each(function (per_stream_bucketer, stream_id) { // We track unread counts for streams that may be currently