From bf81782e59411dd754cdffe06dbd2f5db4738e29 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Mon, 31 Jul 2017 08:11:18 -0400 Subject: [PATCH] Rename num_unread_for_subject -> num_unread_for_topic. --- frontend_tests/node_tests/topic_list.js | 2 +- frontend_tests/node_tests/unread.js | 26 ++++++++++++------------- static/js/topic_list.js | 2 +- static/js/unread.js | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/frontend_tests/node_tests/topic_list.js b/frontend_tests/node_tests/topic_list.js index 51ef658ed1..a5cdb7be74 100644 --- a/frontend_tests/node_tests/topic_list.js +++ b/frontend_tests/node_tests/topic_list.js @@ -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; }; diff --git a/frontend_tests/node_tests/unread.js b/frontend_tests/node_tests/unread.js index cbef01e1e7..4acf878f2f 100644 --- a/frontend_tests/node_tests/unread.js +++ b/frontend_tests/node_tests/unread.js @@ -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); }()); diff --git a/static/js/topic_list.js b/static/js/topic_list.js index d721e91794..647009e578 100644 --- a/static/js/topic_list.js +++ b/static/js/topic_list.js @@ -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; diff --git a/static/js/unread.js b/static/js/unread.js index 430e495b84..6b0b1f7334 100644 --- a/static/js/unread.js +++ b/static/js/unread.js @@ -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); };