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: Allow Ctrl+@ to open mentions view from compose.

Aman Agrawalcc514c9ede31
diff --git a/web/src/hotkey.ts b/web/src/hotkey.ts
index 0e4fb7b0d8d..23546bdc320 100644
--- a/web/src/hotkey.ts
+++ b/web/src/hotkey.ts
@@ -1072,6 +1072,9 @@ function process_hotkey(e: JQuery.KeyDownEvent, hotkey: Hotkey): boolean {
case "star_message":
// Do nothing; this allows one to use Ctrl+S inside compose.
break;
+ case "open_mentions_view":
+ // Do nothing; this allows one to use Ctrl+@ inside compose.
+ break;
default:
// Let the browser handle the key normally.
return false;
diff --git a/web/tests/hotkey.test.cjs b/web/tests/hotkey.test.cjs
index caec51e7cef..505414a1c00 100644
--- a/web/tests/hotkey.test.cjs
+++ b/web/tests/hotkey.test.cjs
@@ -404,6 +404,19 @@ run_test("allow normal typing when editing text", ({override, override_rewire})
}
});
+run_test("Ctrl+@ opens mentions view even while editing text", ({override_rewire}) => {
+ // Ctrl+@ / Cmd+@ should open the mentions view regardless of
+ // whether the focus is in a text input, matching the behavior
+ // of Ctrl+K (search) and Ctrl+S (star message).
+ override_rewire(hotkey, "processing_text", () => true);
+
+ stubbing(browser_history, "go_to_location", (stub) => {
+ assert.ok(hotkey.process_keydown({key: "@", shiftKey: true, ctrlKey: true}));
+ assert.equal(stub.num_calls, 1);
+ assert.equal(stub.last_call_args[0], "#narrow/is/mentioned");
+ });
+});
+
test_while_not_editing_text("streams", ({override}) => {
settings_data.user_can_create_private_streams = () => true;
delete settings_data.user_can_create_public_streams;