From 0a189119aa5e0ad8fe025201e12b344fb8d48e0f Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Tue, 3 Oct 2023 17:57:25 -0700 Subject: [PATCH] stream_list: Rename handle_narrow_deactivated. It did the same thing as handle_narrow_activated when passed the home_msg_list filter. We still leave a renamed version for use by the inbox/recent views. --- web/src/narrow.js | 3 +-- web/src/stream_list.js | 2 +- web/src/views_util.js | 2 +- web/tests/narrow_activate.test.js | 2 +- web/tests/recent_view.test.js | 2 +- web/tests/stream_list.test.js | 2 +- 6 files changed, 6 insertions(+), 7 deletions(-) diff --git a/web/src/narrow.js b/web/src/narrow.js index 98f5f641ea..af67045180 100644 --- a/web/src/narrow.js +++ b/web/src/narrow.js @@ -562,7 +562,6 @@ export function activate(raw_operators, opts) { const current_filter = narrow_state.filter(); pm_list.handle_narrow_activated(current_filter); - stream_list.handle_narrow_activated(current_filter); unread_ui.update_unread_banner(); // It is important to call this after other important updates @@ -1021,6 +1020,7 @@ function handle_post_view_change(msg_list) { message_view_header.render_title_area(); update_narrow_title(filter); left_sidebar_navigation_area.handle_narrow_activated(filter); + stream_list.handle_narrow_activated(filter); } function handle_post_narrow_deactivate_processes(msg_list) { @@ -1029,7 +1029,6 @@ function handle_post_narrow_deactivate_processes(msg_list) { compose_fade.update_message_list(); pm_list.handle_narrow_deactivated(); - stream_list.handle_narrow_deactivated(); message_edit.handle_narrow_deactivated(); widgetize.set_widgets_for_list(); message_feed_top_notices.update_top_of_narrow_notices(msg_list); diff --git a/web/src/stream_list.js b/web/src/stream_list.js index 7c5ec6b78e..fdd290fcf3 100644 --- a/web/src/stream_list.js +++ b/web/src/stream_list.js @@ -666,7 +666,7 @@ export function handle_narrow_activated(filter) { } } -export function handle_narrow_deactivated() { +export function handle_message_view_deactivated() { deselect_stream_items(); topic_zoom.clear_topics(); } diff --git a/web/src/views_util.js b/web/src/views_util.js index 6e64b82c62..9da1bc54c5 100644 --- a/web/src/views_util.js +++ b/web/src/views_util.js @@ -23,7 +23,7 @@ export function show(opts) { // Hide selected elements in the left sidebar. opts.highlight_view_in_left_sidebar(); - stream_list.handle_narrow_deactivated(); + stream_list.handle_message_view_deactivated(); // Hide "middle-column" which has html for rendering // a messages narrow. We hide it and show the view. diff --git a/web/tests/narrow_activate.test.js b/web/tests/narrow_activate.test.js index f7e49262be..39edb8643e 100644 --- a/web/tests/narrow_activate.test.js +++ b/web/tests/narrow_activate.test.js @@ -195,8 +195,8 @@ run_test("basics", ({override}) => { [message_view_header, "render_title_area"], [notifications, "redraw_title"], [left_sidebar_navigation_area, "handle_narrow_activated"], - [compose_actions, "on_narrow"], [stream_list, "handle_narrow_activated"], + [compose_actions, "on_narrow"], [compose_recipient, "update_narrow_to_recipient_visibility"], ]); diff --git a/web/tests/recent_view.test.js b/web/tests/recent_view.test.js index d2746b7de9..80ec85ca50 100644 --- a/web/tests/recent_view.test.js +++ b/web/tests/recent_view.test.js @@ -166,7 +166,7 @@ mock_esm("../src/stream_data", { get_stream_name_from_id: () => "stream_name", }); mock_esm("../src/stream_list", { - handle_narrow_deactivated: noop, + handle_message_view_deactivated: noop, }); mock_esm("../src/timerender", { relative_time_string_from_date: () => "Just now", diff --git a/web/tests/stream_list.test.js b/web/tests/stream_list.test.js index 011253676e..6372ecf90b 100644 --- a/web/tests/stream_list.test.js +++ b/web/tests/stream_list.test.js @@ -458,7 +458,7 @@ test_ui("narrowing", ({mock_template}) => { topics_closed = true; }; - stream_list.handle_narrow_deactivated(); + stream_list.handle_message_view_deactivated(); assert.equal(removed_classes, "active-filter stream-expanded"); assert.ok(topics_closed); });