From beae13b4d6998c5466f8fbe1eda2a60184058c11 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Thu, 6 Aug 2020 12:00:28 -0700 Subject: [PATCH] recent_topics: Renaming confusingly named deletion handlers. This functions were oddly named in a way that didn't make clear their role in handling deleted messages. --- frontend_tests/node_tests/recent_senders.js | 2 +- frontend_tests/node_tests/recent_topics.js | 4 ++-- static/js/recent_senders.js | 2 +- static/js/recent_topics.js | 2 +- static/js/ui.js | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/frontend_tests/node_tests/recent_senders.js b/frontend_tests/node_tests/recent_senders.js index f8d6498751..406db848f8 100644 --- a/frontend_tests/node_tests/recent_senders.js +++ b/frontend_tests/node_tests/recent_senders.js @@ -205,6 +205,6 @@ run_test("process_message_for_senders", () => { // delete message1 and message5 sent by sender1 messages.splice(4, 1); messages.splice(0, 1); - rs.update_topics_of_message_ids([message1.id, message5.id]); + rs.update_topics_of_deleted_message_ids([message1.id, message5.id]); assert.equal(rs.get_topic_recent_senders(stream1, topic1).toString(), "2"); }); diff --git a/frontend_tests/node_tests/recent_topics.js b/frontend_tests/node_tests/recent_topics.js index a45fe2b9bd..7211328863 100644 --- a/frontend_tests/node_tests/recent_topics.js +++ b/frontend_tests/node_tests/recent_topics.js @@ -653,7 +653,7 @@ run_test("test_delete_messages", () => { Array.from(all_topics.keys()).toString(), "4:topic-10,1:topic-7,1:topic-6,1:topic-5,1:topic-4,1:topic-3,1:topic-2,1:topic-1", ); - rt.update_topics_of_message_ids([messages[0].id]); + rt.update_topics_of_deleted_message_ids([messages[0].id]); all_topics = rt.get(); assert.equal( @@ -672,7 +672,7 @@ run_test("test_delete_messages", () => { }, }); - rt.update_topics_of_message_ids([messages[1].id, messages[2].id]); + rt.update_topics_of_deleted_message_ids([messages[1].id, messages[2].id]); all_topics = rt.get(); assert.equal( diff --git a/static/js/recent_senders.js b/static/js/recent_senders.js index 77239aefdb..1d95ca7751 100644 --- a/static/js/recent_senders.js +++ b/static/js/recent_senders.js @@ -73,7 +73,7 @@ exports.process_topic_edit = function (old_stream_id, old_topic, new_topic, new_ // the messages were moved to another stream or deleted. }; -exports.update_topics_of_message_ids = function (message_ids) { +exports.update_topics_of_deleted_message_ids = function (message_ids) { const topics_to_update = new Map(); for (const msg_id of message_ids) { // message_store still has data on deleted messages when this runs. diff --git a/static/js/recent_topics.js b/static/js/recent_topics.js index f699aa4ef5..2ec13c7f9f 100644 --- a/static/js/recent_topics.js +++ b/static/js/recent_topics.js @@ -234,7 +234,7 @@ exports.topic_in_search_results = function (keyword, stream, topic) { return search_words.every((word) => text.includes(word)); }; -exports.update_topics_of_message_ids = function (message_ids) { +exports.update_topics_of_deleted_message_ids = function (message_ids) { const topics_to_rerender = new Map(); for (const msg_id of message_ids) { const message = message_store.get(msg_id); diff --git a/static/js/ui.js b/static/js/ui.js index 37b7dce08f..15a27b9749 100644 --- a/static/js/ui.js +++ b/static/js/ui.js @@ -134,8 +134,8 @@ exports.remove_messages = function (message_ids) { } list.remove_and_rerender(msg_ids_to_rerender); } - recent_senders.update_topics_of_message_ids(message_ids); - recent_topics.update_topics_of_message_ids(message_ids); + recent_senders.update_topics_of_deleted_message_ids(message_ids); + recent_topics.update_topics_of_deleted_message_ids(message_ids); }; exports.show_failed_message_success = function (message_id) {