Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

left_sidebar: Deduplicate handle_narrow_deactivated.

Tim Abbott20b2323c6793
diff --git a/web/src/left_sidebar_navigation_area.js b/web/src/left_sidebar_navigation_area.js
index c05c98ffc40..49381b41de4 100644
--- a/web/src/left_sidebar_navigation_area.js
+++ b/web/src/left_sidebar_navigation_area.js
@@ -81,13 +81,6 @@ export function handle_narrow_activated(filter) {
}
}
-export function handle_narrow_deactivated() {
- deselect_top_left_corner_items();
-
- const $filter_li = $(".top_left_all_messages");
- $filter_li.addClass("active-filter");
-}
-
export function highlight_recent_view() {
remove($(".top_left_all_messages"));
remove($(".top_left_starred_messages"));
diff --git a/web/src/narrow.js b/web/src/narrow.js
index e194e44c9db..98f5f641ea2 100644
--- a/web/src/narrow.js
+++ b/web/src/narrow.js
@@ -561,7 +561,6 @@ export function activate(raw_operators, opts) {
const current_filter = narrow_state.filter();
- left_sidebar_navigation_area.handle_narrow_activated(current_filter);
pm_list.handle_narrow_activated(current_filter);
stream_list.handle_narrow_activated(current_filter);
unread_ui.update_unread_banner();
@@ -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);
}
function handle_post_narrow_deactivate_processes(msg_list) {
@@ -1028,7 +1028,6 @@ function handle_post_narrow_deactivate_processes(msg_list) {
compose_fade.update_message_list();
- left_sidebar_navigation_area.handle_narrow_deactivated();
pm_list.handle_narrow_deactivated();
stream_list.handle_narrow_deactivated();
message_edit.handle_narrow_deactivated();
diff --git a/web/tests/left_sidebar_navigation_area.test.js b/web/tests/left_sidebar_navigation_area.test.js
index 91e17636bbf..8727e094d52 100644
--- a/web/tests/left_sidebar_navigation_area.test.js
+++ b/web/tests/left_sidebar_navigation_area.test.js
@@ -35,9 +35,9 @@ run_test("narrowing", () => {
// deactivating narrow
- left_sidebar_navigation_area.handle_narrow_deactivated();
+ left_sidebar_navigation_area.handle_narrow_activated(new Filter());
- assert.ok($(".top_left_all_messages").hasClass("active-filter"));
+ assert.ok(!$(".top_left_all_messages").hasClass("active-filter"));
assert.ok(!$(".top_left_mentions").hasClass("active-filter"));
assert.ok(!$(".top_left_starred_messages").hasClass("active-filter"));
assert.ok(!$(".top_left_recent_view").hasClass("active-filter"));
@@ -53,7 +53,7 @@ run_test("narrowing", () => {
assert.ok(!$(".top_left_inbox").hasClass("active-filter"));
assert.ok($(".top_left_recent_view").hasClass("active-filter"));
- left_sidebar_navigation_area.handle_narrow_deactivated();
+ left_sidebar_navigation_area.handle_narrow_activated(new Filter());
left_sidebar_navigation_area.highlight_inbox_view();
assert.ok(!$(".top_left_all_messages").hasClass("active-filter"));
assert.ok(!$(".top_left_mentions").hasClass("active-filter"));
diff --git a/web/tests/narrow_activate.test.js b/web/tests/narrow_activate.test.js
index 7e3d181c022..f7e49262be8 100644
--- a/web/tests/narrow_activate.test.js
+++ b/web/tests/narrow_activate.test.js
@@ -194,8 +194,8 @@ run_test("basics", ({override}) => {
[compose_closed_ui, "update_reply_recipient_label"],
[message_view_header, "render_title_area"],
[notifications, "redraw_title"],
- [compose_actions, "on_narrow"],
[left_sidebar_navigation_area, "handle_narrow_activated"],
+ [compose_actions, "on_narrow"],
[stream_list, "handle_narrow_activated"],
[compose_recipient, "update_narrow_to_recipient_visibility"],
]);