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.

settings_panel_menu: Open first section if hash is invalid.

Sahil Batra6b59c3242d32
diff --git a/static/js/settings_panel_menu.js b/static/js/settings_panel_menu.js
index 817d98092d4..204355da970 100644
--- a/static/js/settings_panel_menu.js
+++ b/static/js/settings_panel_menu.js
@@ -115,7 +115,14 @@ export class SettingsPanelMenu {
}
}
- this.$curr_li = this.li_for_section(section);
+ const $li_for_section = this.li_for_section(section);
+ if ($li_for_section.length === 0) {
+ // This happens when there is no such section or the user does not have
+ // permission to view that section.
+ section = this.current_tab();
+ } else {
+ this.$curr_li = $li_for_section;
+ }
this.$main_elem.children("li").removeClass("active");
this.$curr_li.addClass("active");