Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
recent_view: Rename filters_should_hide_topic.
Aman Agrawal2a8174baa3c0
diff --git a/web/src/recent_view_ui.ts b/web/src/recent_view_ui.tsindex 055fe8272ee..d24832c1bc5 100644--- a/web/src/recent_view_ui.ts+++ b/web/src/recent_view_ui.ts@@ -779,7 +779,7 @@ export function update_topics_of_deleted_message_ids(message_ids: number[]): voi}}-export function filters_should_hide_topic(topic_data: ConversationData): boolean {+export function filters_should_hide_row(topic_data: ConversationData): boolean {const msg = message_store.get(topic_data.last_msg_id);assert(msg !== undefined);@@ -878,7 +878,7 @@ export function inplace_rerender(topic_key: string): boolean {assert(topics_widget !== undefined);topics_widget.filter_and_sort();const current_topics_list = topics_widget.get_current_list();- if (is_topic_rendered && filters_should_hide_topic(topic_data)) {+ if (is_topic_rendered && filters_should_hide_row(topic_data)) {// Since the row needs to be removed from DOM, we need to adjust `row_focus`// if the row being removed is focused and is the last row in the list.// This prevents the row_focus either being reset to the first row or@@ -891,16 +891,16 @@ export function inplace_rerender(topic_key: string): boolean {row_focus = current_topics_list.length - 1;}topics_widget.remove_rendered_row($topic_row);- } else if (!is_topic_rendered && filters_should_hide_topic(topic_data)) {+ } else if (!is_topic_rendered && filters_should_hide_row(topic_data)) {// In case `topic_row` is not present, our job is already done here// since it has not been rendered yet and we already removed it from// the filtered list in `topic_widget`. So, it won't be displayed in// the future too.- } else if (is_topic_rendered && !filters_should_hide_topic(topic_data)) {+ } else if (is_topic_rendered && !filters_should_hide_row(topic_data)) {// Only a re-render is required in this case.topics_widget.render_item(topic_data);} else {- // Final case: !is_topic_rendered && !filters_should_hide_topic(topic_data).+ // Final case: !is_topic_rendered && !filters_should_hide_row(topic_data).topics_widget.insert_rendered_row(topic_data, () =>current_topics_list.findIndex((list_item) => list_item.last_msg_id === topic_data.last_msg_id,@@ -1195,10 +1195,10 @@ export function complete_rerender(): void {return render_recent_view_row(format_conversation(item));},filter: {- // We use update_filters_view & filters_should_hide_topic to do all the+ // We use update_filters_view & filters_should_hide_row to do all the// filtering for us, which is called using click_handlers.predicate(topic_data) {- return !filters_should_hide_topic(topic_data);+ return !filters_should_hide_row(topic_data);},},sort_fields: {diff --git a/web/tests/recent_view.test.js b/web/tests/recent_view.test.jsindex e1e4a72784f..05cdcb8591c 100644--- a/web/tests/recent_view.test.js+++ b/web/tests/recent_view.test.js@@ -556,7 +556,7 @@ test("test_no_filter", ({mock_template}) => {recent_view_util.set_visible(true);rt.process_messages([messages[0]]);assert.equal(- rt.filters_should_hide_topic({last_msg_id: 1, participated: true, type: "stream"}),+ rt.filters_should_hide_row({last_msg_id: 1, participated: true, type: "stream"}),false,);@@ -575,7 +575,7 @@ test("test_no_filter", ({mock_template}) => {// stub_out_filter_buttons();// rt.process_messages([messages[9]]);// assert.equal(- // rt.filters_should_hide_topic({last_msg_id: 10, participated: true, type: "stream"}),+ // rt.filters_should_hide_row({last_msg_id: 10, participated: true, type: "stream"}),// true,// );@@ -593,7 +593,7 @@ test("test_no_filter", ({mock_template}) => {// stub_out_filter_buttons();// rt.process_messages([messages[11]]);// assert.equal(- // rt.filters_should_hide_topic({last_msg_id: 12, participated: true, type: "stream"}),+ // rt.filters_should_hide_row({last_msg_id: 12, participated: true, type: "stream"}),// true,// );@@ -612,7 +612,7 @@ test("test_no_filter", ({mock_template}) => {// stub_out_filter_buttons();// rt.process_messages([messages[12]]);// assert.equal(- // rt.filters_should_hide_topic({last_msg_id: 13, participated: true, type: "stream"}),+ // rt.filters_should_hide_row({last_msg_id: 13, participated: true, type: "stream"}),// false,// );@@ -632,7 +632,7 @@ test("test_no_filter", ({mock_template}) => {// stub_out_filter_buttons();// rt.process_messages([messages[13]]);// assert.equal(- // rt.filters_should_hide_topic({last_msg_id: 14, participated: true, type: "stream"}),+ // rt.filters_should_hide_row({last_msg_id: 14, participated: true, type: "stream"}),// false,// );@@ -643,7 +643,7 @@ test("test_no_filter", ({mock_template}) => {rt.set_default_focus();$(".home-page-input").trigger("focus");assert.equal(- rt.filters_should_hide_topic({last_msg_id: 1, participated: true, type: "stream"}),+ rt.filters_should_hide_row({last_msg_id: 1, participated: true, type: "stream"}),false,);});@@ -690,9 +690,9 @@ test("test_filter_pm", ({mock_template}) => {rt.process_messages([private_messages[0]]);- assert.deepEqual(rt.filters_should_hide_topic({type: "private", last_msg_id: 15}), false);- assert.deepEqual(rt.filters_should_hide_topic({type: "private", last_msg_id: 16}), true);- assert.deepEqual(rt.filters_should_hide_topic({type: "private", last_msg_id: 17}), false);+ assert.deepEqual(rt.filters_should_hide_row({type: "private", last_msg_id: 15}), false);+ assert.deepEqual(rt.filters_should_hide_row({type: "private", last_msg_id: 16}), true);+ assert.deepEqual(rt.filters_should_hide_row({type: "private", last_msg_id: 17}), false);});test("test_filter_participated", ({mock_template}) => {@@ -750,14 +750,14 @@ test("test_filter_participated", ({mock_template}) => {$(".home-page-input").trigger("focus");assert.equal(- rt.filters_should_hide_topic({last_msg_id: 4, participated: true, type: "stream"}),+ rt.filters_should_hide_row({last_msg_id: 4, participated: true, type: "stream"}),false,);// Set muted filterrt.set_filter("muted");assert.equal(- rt.filters_should_hide_topic({last_msg_id: 7, participated: true, type: "stream"}),+ rt.filters_should_hide_row({last_msg_id: 7, participated: true, type: "stream"}),false,);@@ -1109,7 +1109,7 @@ test("test_topic_edit", ({override}) => {messages[0].topic = topic8;rt.process_topic_edit(stream3, topic9, topic8, stream5);all_topics = rt_data.get_conversations();- assert.equal(rt.filters_should_hide_topic(all_topics.get("5:topic-8")), true);+ assert.equal(rt.filters_should_hide_row(all_topics.get("5:topic-8")), true);});test("test_search", () => {