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.

hashchange: Change #all-messages to #feed.

nimishmedatwalb141c288558e
diff --git a/web/src/hash_parser.ts b/web/src/hash_parser.ts
index 84fd3efb981..2a4ad27e84f 100644
--- a/web/src/hash_parser.ts
+++ b/web/src/hash_parser.ts
@@ -119,7 +119,11 @@ export function is_spectator_compatible(hash: string): boolean {
"keyboard-shortcuts",
"message-formatting",
"search-operators",
+ // TODO/compatibility: #all_messages was renamed to #feed
+ // in 2024. We should support the old URL fragment at least
+ // until one cannot directly upgrade from Zulip 8.x.
"all_messages",
+ "feed",
"about-zulip",
];
diff --git a/web/src/hashchange.js b/web/src/hashchange.js
index 237b4d205eb..4895cb06840 100644
--- a/web/src/hashchange.js
+++ b/web/src/hashchange.js
@@ -76,6 +76,10 @@ export function set_hash_to_home_view() {
home_view_hash = "#recent";
}
+ if (home_view_hash === "#all_messages") {
+ home_view_hash = "#feed";
+ }
+
if (window.location.hash !== home_view_hash) {
// We want to set URL with no hash here. It is not possible
// to do so with `window.location.hash` since it will set an empty
@@ -197,6 +201,14 @@ function do_hashchange_normal(from_reload) {
inbox_ui.show();
break;
case "#all_messages":
+ // "#all_messages" was renamed to "#feed" in 2024. Unlike
+ // the recent hash rename, there are likely few links that
+ // would break if this compatibility code was removed, but
+ // there's little cost to keeping it.
+ show_all_message_view();
+ window.location.replace("#feed");
+ break;
+ case "#feed":
show_all_message_view();
break;
case "#keyboard-shortcuts":
diff --git a/web/src/hotkey.js b/web/src/hotkey.js
index 642d8463043..0071db5bebc 100644
--- a/web/src/hotkey.js
+++ b/web/src/hotkey.js
@@ -172,7 +172,8 @@ const keypress_mappings = {
83: {name: "toggle_stream_subscription", message_view_only: true}, // 'S'
85: {name: "mark_unread", message_view_only: true}, // 'U'
86: {name: "view_selected_stream", message_view_only: false}, // 'V'
- 97: {name: "all_messages", message_view_only: true}, // 'a'
+ // The shortcut "a" dates from when this was called "All messages".
+ 97: {name: "open_combined_feed", message_view_only: true}, // 'a'
99: {name: "compose", message_view_only: true}, // 'c'
100: {name: "open_drafts", message_view_only: true}, // 'd'
101: {name: "edit_message", message_view_only: true}, // 'e'
@@ -972,8 +973,8 @@ export function process_hotkey(e, hotkey) {
case "open_inbox":
browser_history.go_to_location("#inbox");
return true;
- case "all_messages":
- browser_history.go_to_location("#all_messages");
+ case "open_combined_feed":
+ browser_history.go_to_location("#feed");
return true;
case "toggle_topic_visibility_policy":
if (recent_view_ui.is_in_focus()) {
diff --git a/web/templates/left_sidebar.hbs b/web/templates/left_sidebar.hbs
index ebff80e7350..02a5fc4c96f 100644
--- a/web/templates/left_sidebar.hbs
+++ b/web/templates/left_sidebar.hbs
@@ -22,7 +22,7 @@
</a>
</li>
<li class="top_left_all_messages left-sidebar-navigation-condensed-item {{#if is_all_messages_home_view}}selected-home-view{{/if}}">
- <a href="#all_messages" {{#if is_all_messages_home_view}}tabindex="0"{{/if}} class="home-link tippy-views-tooltip left-sidebar-navigation-icon-container" data-tooltip-template-id="all-message-tooltip-template">
+ <a href="#feed" {{#if is_all_messages_home_view}}tabindex="0"{{/if}} class="home-link tippy-views-tooltip left-sidebar-navigation-icon-container" data-tooltip-template-id="all-message-tooltip-template">
<span class="filter-icon">
<i class="zulip-icon zulip-icon-all-messages" aria-hidden="true"></i>
</span>
@@ -76,7 +76,7 @@
</span>
</li>
<li class="tippy-views-tooltip top_left_all_messages top_left_row {{#if is_all_messages_home_view}}selected-home-view{{/if}}" data-tooltip-template-id="all-message-tooltip-template">
- <a href="#all_messages" {{#if is_all_messages_home_view}}tabindex="0"{{/if}} class="home-link left-sidebar-navigation-label-container">
+ <a href="#feed" {{#if is_all_messages_home_view}}tabindex="0"{{/if}} class="home-link left-sidebar-navigation-label-container">
<span class="filter-icon">
<i class="zulip-icon zulip-icon-all-messages" aria-hidden="true"></i>
</span>
diff --git a/web/tests/hashchange.test.js b/web/tests/hashchange.test.js
index 47fc62c943e..1cbecbfc44d 100644
--- a/web/tests/hashchange.test.js
+++ b/web/tests/hashchange.test.js
@@ -228,7 +228,7 @@ run_test("hash_interactions", ({override, override_rewire}) => {
[message_viewport, "stop_auto_scrolling"],
]);
- window.location.hash = "#all_messages";
+ window.location.hash = "#feed";
hide_all_called = false;
helper.clear_events();
diff --git a/web/tests/hotkey.test.js b/web/tests/hotkey.test.js
index acc6bd61413..b83b8b508ec 100644
--- a/web/tests/hotkey.test.js
+++ b/web/tests/hotkey.test.js
@@ -21,9 +21,8 @@ const $ = require("./lib/zjquery");
// it calls any external module other than `ui.foo`, it'll crash.
// Future work includes making sure it actually does call `ui.foo()`.
-// Since all the tests here are based on narrow starting with all_messages.
-// We set our default narrow to the combined feed here.
-window.location.hash = "#all_messages";
+// All tests use the combined feed as the default narrow.
+window.location.hash = "#feed";
set_global("navigator", {
platform: "",