mirror of
https://github.com/zulip/zulip.git
synced 2025-10-24 08:33:43 +00:00
hashchange: Fix update_browser_history() call for settings.
Even prior to my recent change in settings_panel_menu.js, we were assigning window.location.hash a value that doesn't have a '#' prefix. This probably doesn't matter too much for the browser, but it does confuse our own checks about whether we're redundantly updating browser history. Now we prefix the settings hash with '#' and we encorce this convention with a blueslip error.
This commit is contained in:
@@ -272,6 +272,11 @@ function hashchanged_overlay(old_hash) {
|
||||
exports.update_browser_history = function (new_hash) {
|
||||
var old_hash = window.location.hash;
|
||||
|
||||
if (!new_hash.startsWith('#')) {
|
||||
blueslip.error('programming error: prefix hashes with #: ' + new_hash);
|
||||
return;
|
||||
}
|
||||
|
||||
if (old_hash === new_hash) {
|
||||
// If somebody is calling us with the same hash we already have, it's
|
||||
// probably harmless, and we just ignore it. But it could be a symptom
|
||||
|
||||
@@ -69,7 +69,7 @@ exports.make_menu = function (opts) {
|
||||
curr_li.addClass("active");
|
||||
curr_li.prev().addClass("no-border");
|
||||
|
||||
var settings_section_hash = hash_prefix + section;
|
||||
var settings_section_hash = '#' + hash_prefix + section;
|
||||
hashchange.update_browser_history(settings_section_hash);
|
||||
|
||||
$(".settings-section, .settings-wrapper").removeClass("show");
|
||||
|
||||
Reference in New Issue
Block a user