Rename num_unread_for_subject -> num_unread_for_topic.

This commit is contained in:
Steve Howell
2017-07-31 08:11:18 -04:00
parent fe74e79a17
commit bf81782e59
4 changed files with 16 additions and 16 deletions

View File

@@ -31,7 +31,7 @@ global.compile_template('topic_list_item');
message_id: 400,
});
global.unread.num_unread_for_subject = function () {
global.unread.num_unread_for_topic = function () {
return 1;
};

View File

@@ -78,7 +78,7 @@ var zero_counts = {
(function test_changing_subjects() {
// Summary: change the subject of a message from 'lunch'
// to 'dinner' using update_unread_topics().
var count = unread.num_unread_for_subject('social', 'lunch');
var count = unread.num_unread_for_topic('social', 'lunch');
assert.equal(count, 0);
var stream_id = 100;
@@ -100,7 +100,7 @@ var zero_counts = {
unread.process_loaded_messages([message, other_message]);
count = unread.num_unread_for_subject(stream_id, 'Lunch');
count = unread.num_unread_for_topic(stream_id, 'Lunch');
assert.equal(count, 2);
assert(unread.topic_has_any_unread(stream_id, 'lunch'));
assert(!unread.topic_has_any_unread(wrong_stream_id, 'lunch'));
@@ -111,10 +111,10 @@ var zero_counts = {
unread.update_unread_topics(message, event);
count = unread.num_unread_for_subject(stream_id, 'lUnch');
count = unread.num_unread_for_topic(stream_id, 'lUnch');
assert.equal(count, 1);
count = unread.num_unread_for_subject(stream_id, 'dinner');
count = unread.num_unread_for_topic(stream_id, 'dinner');
assert.equal(count, 1);
event = {
@@ -123,12 +123,12 @@ var zero_counts = {
unread.update_unread_topics(other_message, event);
count = unread.num_unread_for_subject(stream_id, 'lunch');
count = unread.num_unread_for_topic(stream_id, 'lunch');
assert.equal(count, 0);
assert(!unread.topic_has_any_unread(stream_id, 'lunch'));
assert(!unread.topic_has_any_unread(wrong_stream_id, 'lunch'));
count = unread.num_unread_for_subject(stream_id, 'snack');
count = unread.num_unread_for_topic(stream_id, 'snack');
assert.equal(count, 1);
assert(unread.topic_has_any_unread(stream_id, 'snack'));
assert(!unread.topic_has_any_unread(wrong_stream_id, 'snack'));
@@ -143,12 +143,12 @@ var zero_counts = {
// cleanup
message.subject = 'dinner';
unread.process_read_message(message);
count = unread.num_unread_for_subject(stream_id, 'dinner');
count = unread.num_unread_for_topic(stream_id, 'dinner');
assert.equal(count, 0);
other_message.subject = 'snack';
unread.process_read_message(other_message);
count = unread.num_unread_for_subject(stream_id, 'snack');
count = unread.num_unread_for_topic(stream_id, 'snack');
assert.equal(count, 0);
}());
@@ -198,13 +198,13 @@ stream_data.get_stream_id = function () {
assert.equal(unread.num_unread_for_stream(unknown_stream_id), 0);
}());
(function test_num_unread_for_subject() {
// Test the num_unread_for_subject() function using many
(function test_num_unread_for_topic() {
// Test the num_unread_for_topic() function using many
// messages.
unread.declare_bankruptcy();
var stream_id = 301;
var count = unread.num_unread_for_subject(stream_id, 'lunch');
var count = unread.num_unread_for_topic(stream_id, 'lunch');
assert.equal(count, 0);
var message = {
@@ -220,7 +220,7 @@ stream_data.get_stream_id = function () {
unread.process_loaded_messages([message]);
}
count = unread.num_unread_for_subject(stream_id, 'lunch');
count = unread.num_unread_for_topic(stream_id, 'lunch');
assert.equal(count, num_msgs);
for (i = 0; i < num_msgs; i += 1) {
@@ -228,7 +228,7 @@ stream_data.get_stream_id = function () {
unread.process_read_message(message);
}
count = unread.num_unread_for_subject(stream_id, 'lunch');
count = unread.num_unread_for_topic(stream_id, 'lunch');
assert.equal(count, 0);
}());

View File

@@ -65,7 +65,7 @@ exports.build_widget = function (parent_elem, my_stream_id, active_topic, max_to
_.each(topic_names, function (topic_name, idx) {
var show_topic;
var num_unread = unread.num_unread_for_subject(my_stream_id, topic_name);
var num_unread = unread.num_unread_for_topic(my_stream_id, topic_name);
if (zoomed) {
show_topic = true;

View File

@@ -270,7 +270,7 @@ exports.num_unread_for_stream = function (stream_id) {
return exports.unread_topic_counter.get_stream_count(stream_id);
};
exports.num_unread_for_subject = function (stream_id, subject) {
exports.num_unread_for_topic = function (stream_id, subject) {
return exports.unread_topic_counter.get(stream_id, subject);
};