mirror of https://github.com/zulip/zulip.git
user_groups: Reset right panel on changing toggle.
We now reset right panel when toggling from "All groups" to "Your groups" if the group opened in right section is not present in the "Your groups" list, i.e. user is not a member of that group.
This commit is contained in:
parent
3b5bbbc5ee
commit
c5ac75ce60
|
@ -558,6 +558,7 @@ function redraw_left_panel(tab_name) {
|
|||
groups_list_data.sort(compare_by_name);
|
||||
group_list_widget.replace_list_data(groups_list_data);
|
||||
update_empty_left_panel_message();
|
||||
maybe_reset_right_panel(groups_list_data);
|
||||
}
|
||||
|
||||
export function redraw_user_group_list() {
|
||||
|
@ -594,6 +595,20 @@ export function add_or_remove_from_group(group) {
|
|||
}
|
||||
}
|
||||
|
||||
export function maybe_reset_right_panel(groups_list_data) {
|
||||
if (active_group_id === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
const group_ids = new Set(groups_list_data.map((group) => group.id));
|
||||
if (!group_ids.has(active_group_id)) {
|
||||
$(".right .settings").hide();
|
||||
$(".nothing-selected").show();
|
||||
$(".group-row.active").removeClass("active");
|
||||
reset_active_group_id();
|
||||
}
|
||||
}
|
||||
|
||||
export function update_empty_left_panel_message() {
|
||||
// Check if we have any groups in panel to decide whether to
|
||||
// display a notice.
|
||||
|
|
Loading…
Reference in New Issue