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.

hotkey: Add keyboard shortcut to navigate to starred messages view.

opmkumar8911347cdbcd
diff --git a/help/include/view-starred-messages.md b/help/include/view-starred-messages.md
index 716c2a68c3d..210ccb76126 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 <kbd>*</kbd> 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 ac91accfdbd..f2342534cb7 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**: <kbd>A</kbd> — Shows all unmuted messages.
+* **Go to starred messages**: <kbd>*</kbd>
+
* **Go to the conversation you are composing to**: <kbd>Ctrl</kbd> + <kbd>.</kbd>
## Composing messages
diff --git a/web/src/deprecated_feature_notice.ts b/web/src/deprecated_feature_notice.ts
index ff4513a6153..1ac87b23b32 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 6d9ed059195..41e9caaee74 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 c25e94596fc..1e8c2389cd4 100644
--- a/web/templates/keyboard_shortcuts.hbs
+++ b/web/templates/keyboard_shortcuts.hbs
@@ -171,6 +171,10 @@
<td class="definition">{{t 'Go to combined feed' }}</td>
<td><span class="hotkey"><kbd>A</kbd></span></td>
</tr>
+ <tr>
+ <td class="definition">{{t 'Go to starred messages' }}</td>
+ <td><span class="hotkey"><kbd>*</kbd></span></td>
+ </tr>
<tr>
<td class="definition">{{t 'Go to the conversation you are composing to' }}</td>
<td><span class="hotkey"><kbd>Ctrl</kbd> + <kbd>.</kbd></span></td>
diff --git a/web/templates/left_sidebar.hbs b/web/templates/left_sidebar.hbs
index 931e098701e..4809bd7719e 100644
--- a/web/templates/left_sidebar.hbs
+++ b/web/templates/left_sidebar.hbs
@@ -109,7 +109,7 @@
</a>
</li>
<li class="top_left_starred_messages top_left_row hidden-for-spectators">
- <a class="left-sidebar-navigation-label-container" href="#narrow/is/starred">
+ <a class="left-sidebar-navigation-label-container tippy-views-tooltip" href="#narrow/is/starred" data-tooltip-template-id="starred-message-tooltip-template">
<span class="filter-icon">
<i class="zulip-icon zulip-icon-star-filled" aria-hidden="true"></i>
</span>
diff --git a/web/templates/tooltip_templates.hbs b/web/templates/tooltip_templates.hbs
index edb14c5b6b3..2b90174cfa5 100644
--- a/web/templates/tooltip_templates.hbs
+++ b/web/templates/tooltip_templates.hbs
@@ -117,6 +117,12 @@
</div>
{{tooltip_hotkey_hints "T"}}
</template>
+<template id="starred-message-tooltip-template">
+ <div class="views-tooltip-container">
+ <div>{{t 'Starred messages' }}</div>
+ </div>
+ {{tooltip_hotkey_hints "*"}}
+</template>
<template id="my-reactions-tooltip-template">
<div class="views-tooltip-container" data-view-code="recent_topics">
<div>{{t 'Reactions to your messages' }}</div>
diff --git a/web/tests/deprecated_feature_notice.test.js b/web/tests/deprecated_feature_notice.test.js
index 82f8978b55a..868f1d549dc 100644
--- a/web/tests/deprecated_feature_notice.test.js
+++ b/web/tests/deprecated_feature_notice.test.js
@@ -13,18 +13,7 @@ const deprecated_feature_notice = zrequire("deprecated_feature_notice");
run_test("get_hotkey_deprecation_notice", () => {
const expected =
- 'translated HTML: We\'ve replaced the "*" hotkey with "Ctrl + s" to make this common shortcut easier to trigger.';
- const actual = deprecated_feature_notice.get_hotkey_deprecation_notice("*", "Ctrl + s");
+ 'translated HTML: We\'ve replaced the "Shift + C" hotkey with "X" to make this common shortcut easier to trigger.';
+ const actual = deprecated_feature_notice.get_hotkey_deprecation_notice("Shift + C", "X");
assert.equal(actual, expected);
});
-
-run_test("get_hotkey_deprecation_notice_mac", () => {
- navigator.userAgent =
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.167 Safari/537.36";
- const expected =
- 'translated HTML: We\'ve replaced the "*" hotkey with "Cmd + s" to make this common shortcut easier to trigger.';
- const actual = deprecated_feature_notice.get_hotkey_deprecation_notice("*", "Cmd + s");
- assert.equal(actual, expected);
- // Reset userAgent
- navigator.userAgent = "";
-});