diff --git a/web/src/click_handlers.js b/web/src/click_handlers.js index d4ad150d74..935411453e 100644 --- a/web/src/click_handlers.js +++ b/web/src/click_handlers.js @@ -507,7 +507,7 @@ export function initialize() { const sidebarHidden = !$(".app-main .column-left").hasClass("expanded"); popovers.hide_all(); if (sidebarHidden) { - stream_popover.show_streamlist_sidebar(); + sidebar_ui.show_streamlist_sidebar(); } }); diff --git a/web/src/popovers.js b/web/src/popovers.js index 184c1653a1..448646f573 100644 --- a/web/src/popovers.js +++ b/web/src/popovers.js @@ -45,7 +45,7 @@ export function hide_all_except_sidebars(opts) { // or narrow window sidebars. export function hide_all(not_hide_tippy_instances) { sidebar_ui.hide_userlist_sidebar(); - stream_popover.hide_streamlist_sidebar(); + sidebar_ui.hide_streamlist_sidebar(); hide_all_except_sidebars({ not_hide_tippy_instances, }); diff --git a/web/src/sidebar_ui.js b/web/src/sidebar_ui.js index e7eae25ebf..acc252c96c 100644 --- a/web/src/sidebar_ui.js +++ b/web/src/sidebar_ui.js @@ -10,3 +10,12 @@ export function show_userlist_sidebar() { $(".app-main .column-right").addClass("expanded"); resize.resize_page_components(); } + +export function show_streamlist_sidebar() { + $(".app-main .column-left").addClass("expanded"); + resize.resize_stream_filters_container(); +} + +export function hide_streamlist_sidebar() { + $(".app-main .column-left").removeClass("expanded"); +} diff --git a/web/src/stream_list.js b/web/src/stream_list.js index f1273d89e5..cf2f1d2f76 100644 --- a/web/src/stream_list.js +++ b/web/src/stream_list.js @@ -18,9 +18,9 @@ import * as popovers from "./popovers"; import * as resize from "./resize"; import * as scroll_util from "./scroll_util"; import * as settings_data from "./settings_data"; +import * as sidebar_ui from "./sidebar_ui"; import * as stream_data from "./stream_data"; import * as stream_list_sort from "./stream_list_sort"; -import * as stream_popover from "./stream_popover"; import * as sub_store from "./sub_store"; import * as topic_list from "./topic_list"; import * as topic_zoom from "./topic_zoom"; @@ -848,7 +848,7 @@ export function initiate_search() { !$(".app-main .column-left").hasClass("expanded") ) { popovers.hide_all(); - stream_popover.show_streamlist_sidebar(); + sidebar_ui.show_streamlist_sidebar(); } $filter.trigger("focus"); diff --git a/web/src/stream_popover.js b/web/src/stream_popover.js index eefc59bf37..35b272865b 100644 --- a/web/src/stream_popover.js +++ b/web/src/stream_popover.js @@ -17,7 +17,6 @@ import * as message_edit from "./message_edit"; import * as popover_menus from "./popover_menus"; import {left_sidebar_tippy_options} from "./popover_menus"; import * as popovers from "./popovers"; -import * as resize from "./resize"; import * as settings_data from "./settings_data"; import * as stream_bar from "./stream_bar"; import * as stream_color from "./stream_color"; @@ -85,15 +84,6 @@ export function hide_stream_popover() { } } -export function show_streamlist_sidebar() { - $(".app-main .column-left").addClass("expanded"); - resize.resize_stream_filters_container(); -} - -export function hide_streamlist_sidebar() { - $(".app-main .column-left").removeClass("expanded"); -} - function stream_popover_sub(e) { const $elem = $(e.currentTarget).parents("ul"); const stream_id = elem_to_stream_id($elem); diff --git a/web/src/user_search.js b/web/src/user_search.js index 5558eb234e..dbcc609926 100644 --- a/web/src/user_search.js +++ b/web/src/user_search.js @@ -3,7 +3,6 @@ import $ from "jquery"; import * as popovers from "./popovers"; import * as resize from "./resize"; import * as sidebar_ui from "./sidebar_ui"; -import * as stream_popover from "./stream_popover"; export class UserSearch { // This is mostly view code to manage the user search widget @@ -98,7 +97,7 @@ export class UserSearch { if (!$column.hasClass("expanded")) { popovers.hide_all(); if ($column.hasClass("column-left")) { - stream_popover.show_streamlist_sidebar(); + sidebar_ui.show_streamlist_sidebar(); } else if ($column.hasClass("column-right")) { sidebar_ui.show_userlist_sidebar(); } diff --git a/web/tests/stream_search.test.js b/web/tests/stream_search.test.js index 53248a4bbe..223c73645a 100644 --- a/web/tests/stream_search.test.js +++ b/web/tests/stream_search.test.js @@ -18,7 +18,7 @@ mock_esm("../src/resize", { }); const popovers = mock_esm("../src/popovers"); -const stream_popover = mock_esm("../src/stream_popover"); +const sidebar_ui = mock_esm("../src/sidebar_ui"); const stream_list = zrequire("stream_list"); @@ -181,12 +181,12 @@ run_test("expanding_sidebar", () => { popovers.hide_all = () => { events.push("popovers.hide_all"); }; - stream_popover.show_streamlist_sidebar = () => { - events.push("stream_popover.show_streamlist_sidebar"); + sidebar_ui.show_streamlist_sidebar = () => { + events.push("sidebar_ui.show_streamlist_sidebar"); }; $("#streamlist-toggle").show(); stream_list.initiate_search(); - assert.deepEqual(events, ["popovers.hide_all", "stream_popover.show_streamlist_sidebar"]); + assert.deepEqual(events, ["popovers.hide_all", "sidebar_ui.show_streamlist_sidebar"]); }); diff --git a/web/tests/user_search.test.js b/web/tests/user_search.test.js index f60b63498b..239138fb34 100644 --- a/web/tests/user_search.test.js +++ b/web/tests/user_search.test.js @@ -123,7 +123,7 @@ test("blur search right", ({override}) => { }); test("blur search left", ({override}) => { - override(stream_popover, "show_streamlist_sidebar", () => {}); + override(sidebar_ui, "show_streamlist_sidebar", () => {}); override(popovers, "hide_all", () => {}); override(popovers, "hide_all_except_sidebars", () => {}); override(resize, "resize_sidebars", () => {});