Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

group_settings: Include tab selected in right section in url hash.

Sahil Batra61d481559fcb
diff --git a/web/src/hash_util.ts b/web/src/hash_util.ts
index 90a52730565..5106b693eca 100644
--- a/web/src/hash_util.ts
+++ b/web/src/hash_util.ts
@@ -147,8 +147,8 @@ export function stream_edit_url(sub: StreamSubscription, right_side_tab: string)
)}/${right_side_tab}`;
}
-export function group_edit_url(group: UserGroup): string {
- const hash = `#groups/${group.id}/${internal_url.encodeHashComponent(group.name)}`;
+export function group_edit_url(group: UserGroup, right_side_tab: string): string {
+ const hash = `#groups/${group.id}/${internal_url.encodeHashComponent(group.name)}/${right_side_tab}`;
return hash;
}
diff --git a/web/src/hashchange.js b/web/src/hashchange.js
index fc9134e9c60..f0b5d14e1de 100644
--- a/web/src/hashchange.js
+++ b/web/src/hashchange.js
@@ -262,7 +262,8 @@ function do_hashchange_overlay(old_hash) {
}
if (base === "groups") {
- user_group_edit.change_state(section);
+ const right_side_tab = hash_parser.get_current_nth_hash_section(3);
+ user_group_edit.change_state(section, right_side_tab);
}
if (base === "settings") {
@@ -329,7 +330,8 @@ function do_hashchange_overlay(old_hash) {
}
if (base === "groups") {
- user_group_edit.launch(section);
+ const right_side_tab = hash_parser.get_current_nth_hash_section(3);
+ user_group_edit.launch(section, right_side_tab);
return;
}
diff --git a/web/src/user_group_edit.js b/web/src/user_group_edit.js
index a0b32287eee..343abaf5470 100644
--- a/web/src/user_group_edit.js
+++ b/web/src/user_group_edit.js
@@ -38,11 +38,6 @@ let group_list_widget;
let group_list_toggler;
let active_group_id;
-function setup_group_edit_hash(group) {
- const hash = hash_util.group_edit_url(group);
- browser_history.update(hash);
-}
-
function get_user_group_id(target) {
const $row = $(target).closest(
".group-row, .user_group_settings_wrapper, .save-button, .group_settings_header",
@@ -303,6 +298,8 @@ export function setup_group_settings(group) {
$(".group_setting_section").hide();
$(`[data-group-section="${CSS.escape(key)}"]`).show();
select_tab = key;
+ const hash = hash_util.group_edit_url(group, select_tab);
+ browser_history.update(hash);
},
});
@@ -413,7 +410,6 @@ export function show_group_settings(group) {
$(".group-row.active").removeClass("active");
show_user_group_settings_pane.settings(group);
row_for_group_id(group.id).addClass("active");
- setup_group_edit_hash(group);
setup_group_settings(group);
}
@@ -559,7 +555,7 @@ export function update_group(group_id) {
}
}
-export function change_state(section) {
+export function change_state(section, right_side_tab) {
if (section === "new") {
do_open_create_user_group();
redraw_user_group_list();
@@ -592,6 +588,7 @@ export function change_state(section) {
// based on the tab that is active. It is `your-groups`
// tab by default.
redraw_user_group_list();
+ select_tab = right_side_tab;
switch_to_group_row(group);
}
return;
@@ -970,7 +967,7 @@ export function initialize() {
);
}
-export function launch(section) {
+export function launch(section, right_side_tab) {
setup_page(() => {
overlays.open_overlay({
name: "group_subscriptions",
@@ -979,7 +976,7 @@ export function launch(section) {
browser_history.exit_overlay();
},
});
- change_state(section);
+ change_state(section, right_side_tab);
});
if (!get_active_data().id) {
if (section === "new") {
diff --git a/web/src/user_group_popover.ts b/web/src/user_group_popover.ts
index d3ae1d85dc7..8eb404f2a59 100644
--- a/web/src/user_group_popover.ts
+++ b/web/src/user_group_popover.ts
@@ -96,7 +96,7 @@ export function toggle_user_group_info_popover(
group_name: group.name,
group_description: group.description,
members: sort_group_members(fetch_group_members([...group.members])),
- group_edit_url: hash_util.group_edit_url(group),
+ group_edit_url: hash_util.group_edit_url(group, "general"),
is_guest: current_user.is_guest,
};
instance.setContent(ui_util.parse_html(render_user_group_info_popover(args)));