hashchange: Change #all-messages to #feed.

This commit changes the hash for the combined feed view from the
legacy #all-messages to #feed.

Fixes #27802.
This commit is contained in:
nimishmedatwal
2024-04-24 00:28:34 +05:30
committed by Tim Abbott
parent 10f0d5dce3
commit b141c28855
6 changed files with 25 additions and 9 deletions

View File

@@ -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",
];

View File

@@ -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":

View File

@@ -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()) {

View File

@@ -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>

View File

@@ -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();

View File

@@ -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: "",