Rename subject_count -> topic_count.

This fixes all names in the JS codebase.
This commit is contained in:
Steve Howell
2017-07-31 08:04:20 -04:00
parent d1c5cef186
commit fe74e79a17
4 changed files with 10 additions and 10 deletions

View File

@@ -409,7 +409,7 @@ function initialize_stream_data() {
stream_count.set(stream_id, 0);
var counts = {
stream_count: stream_count,
subject_count: new Dict(),
topic_count: new Dict(),
mentioned_message_count: 222,
home_unread_messages: 333,
};
@@ -439,7 +439,7 @@ function initialize_stream_data() {
var topic_count = new Dict({fold_case: true});
topic_count.set('lunch', '555');
counts.subject_count.set(stream_id, topic_count);
counts.topic_count.set(stream_id, topic_count);
stream_list.update_dom_with_unread_counts(counts);

View File

@@ -46,7 +46,7 @@ var zero_counts = {
home_unread_messages: 0,
mentioned_message_count: 0,
stream_count: new Dict(),
subject_count: new Dict(),
topic_count: new Dict(),
pm_count: new Dict(),
unread_in_current_view: 0,
};

View File

@@ -334,8 +334,8 @@ exports.update_dom_with_unread_counts = function (counts) {
set_stream_unread_count(stream_id, count);
});
// counts.subject_count maps streams to hashes of topics to counts
counts.subject_count.each(function (subject_hash, stream_id) {
// counts.topic_count maps streams to hashes of topics to counts
counts.topic_count.each(function (subject_hash, stream_id) {
subject_hash.each(function (count, subject) {
topic_list.set_count(stream_id, subject, count);
});

View File

@@ -64,7 +64,7 @@ exports.unread_topic_counter = (function () {
var res = {};
res.stream_unread_messages = 0;
res.stream_count = num_dict(); // hash by stream_id -> count
res.subject_count = num_dict(); // hash of hashes (stream_id, then subject -> count)
res.topic_count = num_dict(); // hash of hashes (stream_id, then topic -> count)
unread_topics.each(function (_, stream_id) {
// We track unread counts for streams that may be currently
@@ -77,11 +77,11 @@ exports.unread_topic_counter = (function () {
}
if (unread_topics.has(stream_id)) {
res.subject_count.set(stream_id, str_dict());
res.topic_count.set(stream_id, str_dict());
var stream_count = 0;
unread_topics.get(stream_id).each(function (msgs, topic) {
var topic_count = msgs.num_items();
res.subject_count.get(stream_id).set(topic, topic_count);
res.topic_count.get(stream_id).set(topic, topic_count);
if (!muting.is_topic_muted(sub.name, topic)) {
stream_count += topic_count;
}
@@ -242,11 +242,11 @@ exports.get_counts = function () {
res.mentioned_message_count = unread_mentioned.num_items();
res.pm_count = new Dict(); // Hash by user_ids_string -> count
// This sets stream_count, subject_count, and home_unread_messages
// This sets stream_count, topic_count, and home_unread_messages
var topic_res = exports.unread_topic_counter.get_counts(res);
res.home_unread_messages = topic_res.stream_unread_messages;
res.stream_count = topic_res.stream_count;
res.subject_count = topic_res.subject_count;
res.topic_count = topic_res.topic_count;
var pm_count = 0;
unread_privates.each(function (obj, user_ids_string) {