From 8549e9b648372a7a01095ca76da53cba47ee8295 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. (cherry picked from commit c6be850fb96655231a7e0af920b46da6a10da112) --- web/src/hashchange.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/web/src/hashchange.js b/web/src/hashchange.js index 0241651fde..9959fe4f96 100644 --- a/web/src/hashchange.js +++ b/web/src/hashchange.js @@ -240,6 +240,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. //