mirror of https://github.com/zulip/zulip.git
stream_popover: Move left sidebar function to sidebar_ui.
This commit is contained in:
parent
820b564072
commit
b065cfa0c1
|
@ -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();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -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,
|
||||
});
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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"]);
|
||||
});
|
||||
|
|
|
@ -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", () => {});
|
||||
|
|
Loading…
Reference in New Issue