unread: Remove topic counts.

We no longer use topic counts from unread.get_counts().
The topic list widget instead calls
unread.num_unread_for_topic().
This commit is contained in:
Steve Howell 2020-02-01 14:42:36 +00:00 committed by Tim Abbott
parent f0e18b3b3e
commit 58859ab115
2 changed files with 0 additions and 11 deletions

View File

@ -38,7 +38,6 @@ const zero_counts = {
home_unread_messages: 0,
mentioned_message_count: 0,
stream_count: new IntDict(),
topic_count: new IntDict(),
pm_count: new Dict(),
};

View File

@ -236,17 +236,10 @@ exports.unread_topic_counter = (function () {
bucketer.delete(msg_id);
};
function str_dict() {
// Use this when keys are topics
return new FoldDict();
}
self.get_counts = function () {
const res = {};
res.stream_unread_messages = 0;
res.stream_count = new IntDict(); // hash by stream_id -> count
res.topic_count = new IntDict(); // hash of hashes (stream_id, then topic -> count)
for (const [stream_id, per_stream_bucketer] of bucketer) {
// We track unread counts for streams that may be currently
@ -258,11 +251,9 @@ exports.unread_topic_counter = (function () {
continue;
}
res.topic_count.set(stream_id, str_dict());
let stream_count = 0;
for (const [topic, msgs] of per_stream_bucketer) {
const topic_count = msgs.size;
res.topic_count.get(stream_id).set(topic, topic_count);
if (!muting.is_topic_muted(stream_id, topic)) {
stream_count += topic_count;
}
@ -496,7 +487,6 @@ exports.get_counts = function () {
const topic_res = exports.unread_topic_counter.get_counts();
res.home_unread_messages = topic_res.stream_unread_messages;
res.stream_count = topic_res.stream_count;
res.topic_count = topic_res.topic_count;
const pm_res = exports.unread_pm_counter.get_counts();
res.pm_count = pm_res.pm_dict;