From 055b13a7a830cd6576002bb7b2bb63c8383d8f06 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Thu, 23 Jan 2020 14:36:11 +0000 Subject: [PATCH] minor: Update code comments in topic_data. The main Dict here used to point to an array, but that changed a few years ago. --- static/js/topic_data.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/static/js/topic_data.js b/static/js/topic_data.js index 65cd3836ce..c69951050b 100644 --- a/static/js/topic_data.js +++ b/static/js/topic_data.js @@ -1,7 +1,7 @@ const Dict = require('./dict').Dict; const FoldDict = require('./fold_dict').FoldDict; -let stream_dict = new Dict(); // stream_id -> array of objects +let stream_dict = new Dict(); // stream_id -> topic_history object exports.stream_has_topics = function (stream_id) { if (!stream_dict.has(stream_id)) { @@ -14,6 +14,13 @@ exports.stream_has_topics = function (stream_id) { }; exports.topic_history = function (stream_id) { + /* + Each stream has a dictionary of topics. + The main getter of this object is + get_recent_names, and we just sort on + the fly every time we are called. + */ + const topics = new FoldDict(); const self = {};