mirror of
https://github.com/zulip/zulip.git
synced 2025-11-09 08:26:11 +00:00
stream_list: Clean up component API.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
9d8c6f9186
commit
fba8c23dc0
@@ -681,7 +681,7 @@ export function initialize_stream_cursor() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function initialize({narrow_on_stream_click}) {
|
export function initialize({on_stream_click}) {
|
||||||
create_initial_sidebar_rows();
|
create_initial_sidebar_rows();
|
||||||
|
|
||||||
// We build the stream_list now. It may get re-built again very shortly
|
// We build the stream_list now. It may get re-built again very shortly
|
||||||
@@ -689,18 +689,17 @@ export function initialize({narrow_on_stream_click}) {
|
|||||||
build_stream_list();
|
build_stream_list();
|
||||||
update_subscribe_to_more_streams_link();
|
update_subscribe_to_more_streams_link();
|
||||||
initialize_stream_cursor();
|
initialize_stream_cursor();
|
||||||
set_event_handlers({narrow_on_stream_click});
|
set_event_handlers({on_stream_click});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function set_event_handlers({narrow_on_stream_click}) {
|
export function set_event_handlers({on_stream_click}) {
|
||||||
$("#stream_filters").on("click", "li .subscription_block", (e) => {
|
$("#stream_filters").on("click", "li .subscription_block", (e) => {
|
||||||
if (e.metaKey || e.ctrlKey) {
|
if (e.metaKey || e.ctrlKey) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const stream_id = stream_id_for_elt($(e.target).parents("li"));
|
const stream_id = stream_id_for_elt($(e.target).parents("li"));
|
||||||
const sub = sub_store.get(stream_id);
|
|
||||||
popovers.hide_all();
|
popovers.hide_all();
|
||||||
narrow_on_stream_click("stream", sub.name, {trigger: "sidebar"});
|
on_stream_click(stream_id, "sidebar");
|
||||||
|
|
||||||
clear_and_hide_search();
|
clear_and_hide_search();
|
||||||
|
|
||||||
@@ -754,15 +753,8 @@ export function set_event_handlers({narrow_on_stream_click}) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const sub = sub_store.get(stream_id);
|
|
||||||
|
|
||||||
if (sub === undefined) {
|
|
||||||
blueslip.error("Unknown stream_id for search/enter", {stream_id});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
clear_and_hide_search();
|
clear_and_hide_search();
|
||||||
narrow_on_stream_click("stream", sub.name, {trigger: "sidebar enter key"});
|
on_stream_click(stream_id, "sidebar enter key");
|
||||||
}
|
}
|
||||||
|
|
||||||
keydown_util.handle({
|
keydown_util.handle({
|
||||||
|
|||||||
@@ -654,7 +654,12 @@ export function initialize_everything() {
|
|||||||
stream_settings_ui.initialize();
|
stream_settings_ui.initialize();
|
||||||
user_group_settings_ui.initialize();
|
user_group_settings_ui.initialize();
|
||||||
top_left_corner.initialize();
|
top_left_corner.initialize();
|
||||||
stream_list.initialize({narrow_on_stream_click: narrow.by});
|
stream_list.initialize({
|
||||||
|
on_stream_click(stream_id, trigger) {
|
||||||
|
const sub = sub_store.get(stream_id);
|
||||||
|
narrow.by("stream", sub.name, {trigger});
|
||||||
|
},
|
||||||
|
});
|
||||||
stream_list_sort.initialize();
|
stream_list_sort.initialize();
|
||||||
condense.initialize();
|
condense.initialize();
|
||||||
spoilers.initialize();
|
spoilers.initialize();
|
||||||
|
|||||||
Reference in New Issue
Block a user