mirror of https://github.com/zulip/zulip.git
stream_settings: Show relevant streams in left panel.
We want to make the default stream listing more relevant. To do this, we always show "All streams" tab when stream is opened from another user's profile. From other places, we show "Subscribed" if the user is subscribed to the stream they are trying to edit otherwise "All streams" are shown.
This commit is contained in:
parent
9275a8ded4
commit
25cca93bc9
|
@ -278,7 +278,7 @@ function do_hashchange_overlay(old_hash) {
|
||||||
if (base === "streams") {
|
if (base === "streams") {
|
||||||
// e.g. #streams/29/social/subscribers
|
// e.g. #streams/29/social/subscribers
|
||||||
const right_side_tab = hash_parser.get_current_nth_hash_section(3);
|
const right_side_tab = hash_parser.get_current_nth_hash_section(3);
|
||||||
stream_settings_ui.change_state(section, right_side_tab);
|
stream_settings_ui.change_state(section, undefined, right_side_tab);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,7 +346,17 @@ function do_hashchange_overlay(old_hash) {
|
||||||
if (base === "streams") {
|
if (base === "streams") {
|
||||||
// e.g. #streams/29/social/subscribers
|
// e.g. #streams/29/social/subscribers
|
||||||
const right_side_tab = hash_parser.get_current_nth_hash_section(3);
|
const right_side_tab = hash_parser.get_current_nth_hash_section(3);
|
||||||
stream_settings_ui.launch(section, right_side_tab);
|
|
||||||
|
if (is_somebody_else_profile_open()) {
|
||||||
|
stream_settings_ui.launch(section, "all-streams", right_side_tab);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We pass left_side_tab as undefined in change_state to
|
||||||
|
// select the tab based on user's subscriptions. "Subscribed" is
|
||||||
|
// selected if user is subscribed to the stream being edited.
|
||||||
|
// Otherwise "All streams" is selected.
|
||||||
|
stream_settings_ui.launch(section, undefined, right_side_tab);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -699,7 +699,7 @@ function show_right_section() {
|
||||||
resize.resize_stream_subscribers_list();
|
resize.resize_stream_subscribers_list();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function change_state(section, right_side_tab) {
|
export function change_state(section, left_side_tab, right_side_tab) {
|
||||||
// if in #streams/new form.
|
// if in #streams/new form.
|
||||||
if (section === "new") {
|
if (section === "new") {
|
||||||
do_open_create_stream();
|
do_open_create_stream();
|
||||||
|
@ -718,6 +718,20 @@ export function change_state(section, right_side_tab) {
|
||||||
const stream_id = Number.parseInt(section, 10);
|
const stream_id = Number.parseInt(section, 10);
|
||||||
show_right_section();
|
show_right_section();
|
||||||
stream_edit_toggler.set_select_tab(right_side_tab);
|
stream_edit_toggler.set_select_tab(right_side_tab);
|
||||||
|
|
||||||
|
if (left_side_tab === undefined) {
|
||||||
|
left_side_tab = "all-streams";
|
||||||
|
if (stream_data.is_subscribed(stream_id)) {
|
||||||
|
left_side_tab = "subscribed";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Callback to .goto() will update browser_history unless a
|
||||||
|
// stream is being edited. We are always editing a stream here
|
||||||
|
// so its safe to call
|
||||||
|
if (left_side_tab !== toggler.value()) {
|
||||||
|
toggler.goto(left_side_tab);
|
||||||
|
}
|
||||||
switch_to_stream_row(stream_id);
|
switch_to_stream_row(stream_id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -726,7 +740,7 @@ export function change_state(section, right_side_tab) {
|
||||||
stream_edit.empty_right_panel();
|
stream_edit.empty_right_panel();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function launch(section, right_side_tab) {
|
export function launch(section, left_side_tab, right_side_tab) {
|
||||||
setup_page(() => {
|
setup_page(() => {
|
||||||
overlays.open_overlay({
|
overlays.open_overlay({
|
||||||
name: "subscriptions",
|
name: "subscriptions",
|
||||||
|
@ -736,7 +750,7 @@ export function launch(section, right_side_tab) {
|
||||||
$(".colorpicker").spectrum("destroy");
|
$(".colorpicker").spectrum("destroy");
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
change_state(section, right_side_tab);
|
change_state(section, left_side_tab, right_side_tab);
|
||||||
});
|
});
|
||||||
if (!stream_settings_components.get_active_data().id) {
|
if (!stream_settings_components.get_active_data().id) {
|
||||||
if (section === "new") {
|
if (section === "new") {
|
||||||
|
|
Loading…
Reference in New Issue