From c6be850fb96655231a7e0af920b46da6a10da112 Mon Sep 17 00:00:00 2001 From: Sahil Batra Date: Thu, 18 Jan 2024 15:45:53 +0530 Subject: [PATCH] groups_settings: Fix browser back button for groups overlay. There is no problem in behavior of browser back button if we open the group settings overlay using "#groups/your", "#groups/all" or "#groups/new" url hash, but someone can directly go to a link with "#groups" and in this case we want to fix the browser back button. This commit replaces "#groups" entry with "#groups/your" which is the default section opened, such that pressing back when on "#groups/your" does not go to "#groups", which will then a form a cycle and instead go back actually. --- web/src/hashchange.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/web/src/hashchange.js b/web/src/hashchange.js index 791a3e640e..ed22d2906b 100644 --- a/web/src/hashchange.js +++ b/web/src/hashchange.js @@ -241,6 +241,10 @@ function do_hashchange_overlay(old_hash) { history.replaceState(null, "", browser_history.get_full_url("streams/subscribed")); } + if (base === "groups" && !section) { + history.replaceState(null, "", browser_history.get_full_url("groups/your")); + } + // Start by handling the specific case of going // from something like streams/all to streams_subscribed. //