From 8911347cdbcd62cd9cc418fc2d77cf40fb9c47e9 Mon Sep 17 00:00:00 2001 From: opmkumar Date: Fri, 23 Aug 2024 23:28:23 +0530 Subject: [PATCH] hotkey: Add keyboard shortcut to navigate to starred messages view. This commit adds '*' as a keyboard shortcut to navigate to the starred messages view and the shortcut is documented in various required locations accordingly. Fixes #31397. --- help/include/view-starred-messages.md | 5 +++++ help/keyboard-shortcuts.md | 2 ++ web/src/deprecated_feature_notice.ts | 5 ----- web/src/hotkey.js | 8 ++++---- web/templates/keyboard_shortcuts.hbs | 4 ++++ web/templates/left_sidebar.hbs | 2 +- web/templates/tooltip_templates.hbs | 6 ++++++ web/tests/deprecated_feature_notice.test.js | 15 ++------------- 8 files changed, 24 insertions(+), 23 deletions(-) diff --git a/help/include/view-starred-messages.md b/help/include/view-starred-messages.md index 716c2a68c3..210ccb7612 100644 --- a/help/include/view-starred-messages.md +++ b/help/include/view-starred-messages.md @@ -11,6 +11,11 @@ You can also [search your starred messages](/help/search-for-messages) using the `is:starred` filter. +!!! keyboard_tip "" + + Use * to view your starred messages. + + {tab|mobile} 1. Tap the **Starred messages** diff --git a/help/keyboard-shortcuts.md b/help/keyboard-shortcuts.md index ac91accfdb..f2342534cb 100644 --- a/help/keyboard-shortcuts.md +++ b/help/keyboard-shortcuts.md @@ -108,6 +108,8 @@ in the Zulip app to add more to your repertoire as needed. * **Go to combined feed**: A — Shows all unmuted messages. +* **Go to starred messages**: * + * **Go to the conversation you are composing to**: Ctrl + . ## Composing messages diff --git a/web/src/deprecated_feature_notice.ts b/web/src/deprecated_feature_notice.ts index ff4513a615..1ac87b23b3 100644 --- a/web/src/deprecated_feature_notice.ts +++ b/web/src/deprecated_feature_notice.ts @@ -1,7 +1,6 @@ import {z} from "zod"; import * as blueslip from "./blueslip"; -import * as common from "./common"; import * as dialog_widget from "./dialog_widget"; import {$t_html} from "./i18n"; import {localstorage} from "./localstorage"; @@ -23,14 +22,10 @@ let shown_deprecation_notices: string[] = []; export function maybe_show_deprecation_notice(key: string): void { let message; - const isCmdOrCtrl = common.has_mac_keyboard() ? "Cmd" : "Ctrl"; switch (key) { case "Shift + C": message = get_hotkey_deprecation_notice("Shift + C", "X"); break; - case "*": - message = get_hotkey_deprecation_notice("*", isCmdOrCtrl + " + S"); - break; case "Shift + S": message = get_hotkey_deprecation_notice("Shift + S", "S"); break; diff --git a/web/src/hotkey.js b/web/src/hotkey.js index 6d9ed05919..41e9caaee7 100644 --- a/web/src/hotkey.js +++ b/web/src/hotkey.js @@ -150,7 +150,7 @@ const keydown_either_mappings = { }; const keypress_mappings = { - 42: {name: "star_deprecated", message_view_only: true}, // '*' + 42: {name: "open_starred_message_view", message_view_only: true}, // '*' 43: {name: "thumbs_up_emoji", message_view_only: true}, // '+' 61: {name: "upvote_first_emoji", message_view_only: true}, // '=' 45: {name: "toggle_message_collapse", message_view_only: true}, // '-' @@ -996,6 +996,9 @@ export function process_hotkey(e, hotkey) { case "open_inbox": browser_history.go_to_location("#inbox"); return true; + case "open_starred_message_view": + browser_history.go_to_location("#narrow/is/starred"); + return true; case "open_combined_feed": browser_history.go_to_location("#feed"); return true; @@ -1044,9 +1047,6 @@ export function process_hotkey(e, hotkey) { case "C_deprecated": deprecated_feature_notice.maybe_show_deprecation_notice("Shift + C"); return true; - case "star_deprecated": - deprecated_feature_notice.maybe_show_deprecation_notice("*"); - return true; } // Hotkeys below this point are for the message feed, and so diff --git a/web/templates/keyboard_shortcuts.hbs b/web/templates/keyboard_shortcuts.hbs index c25e94596f..1e8c2389cd 100644 --- a/web/templates/keyboard_shortcuts.hbs +++ b/web/templates/keyboard_shortcuts.hbs @@ -171,6 +171,10 @@ {{t 'Go to combined feed' }} A + + {{t 'Go to starred messages' }} + * + {{t 'Go to the conversation you are composing to' }} Ctrl + . diff --git a/web/templates/left_sidebar.hbs b/web/templates/left_sidebar.hbs index 931e098701..4809bd7719 100644 --- a/web/templates/left_sidebar.hbs +++ b/web/templates/left_sidebar.hbs @@ -109,7 +109,7 @@
  • - + diff --git a/web/templates/tooltip_templates.hbs b/web/templates/tooltip_templates.hbs index edb14c5b6b..2b90174cfa 100644 --- a/web/templates/tooltip_templates.hbs +++ b/web/templates/tooltip_templates.hbs @@ -117,6 +117,12 @@ {{tooltip_hotkey_hints "T"}} +