From e1d4fb90d73e2fef93394534fcd42e3014fc32d5 Mon Sep 17 00:00:00 2001 From: lonerz Date: Thu, 29 Dec 2016 03:50:17 +0000 Subject: [PATCH] hotkeys: Add '@' as a hotkey to compose message with mention. --- static/js/hotkey.js | 6 ++++++ templates/zerver/help/keyboard-shortcuts.md | 3 +++ templates/zerver/keyboard_shortcuts.html | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/static/js/hotkey.js b/static/js/hotkey.js index cf12406224..56d7bb8e2e 100644 --- a/static/js/hotkey.js +++ b/static/js/hotkey.js @@ -43,6 +43,7 @@ var hotkeys_shift_insensitive = { 27: {name: 'escape', message_view_only: false}, // escape 47: {name: 'search', message_view_only: false}, // '/' 63: {name: 'show_shortcuts', message_view_only: false}, // '?' + 64: {name: 'compose_reply_with_mention', message_view_only: true}, // '@' 65: {name: 'stream_cycle_backward', message_view_only: true}, // 'A' 67: {name: 'compose_private_message', message_view_only: true}, // 'C' 68: {name: 'stream_cycle_forward', message_view_only: true}, // 'D' @@ -364,6 +365,11 @@ function process_hotkey(e) { case 'respond_to_author': // 'R': respond to author compose.respond_to_message({reply_type: "personal", trigger: 'hotkey pm'}); return true; + case 'compose_reply_with_mention': // '@': respond to message with mention to author + compose.respond_to_message({trigger: 'hotkey'}); + var message = current_msg_list.selected_message(); + $("#new_message_content").val('@**' + message.sender_full_name + '** '); + return true; } return false; diff --git a/templates/zerver/help/keyboard-shortcuts.md b/templates/zerver/help/keyboard-shortcuts.md index 20daab9911..d4f425a789 100644 --- a/templates/zerver/help/keyboard-shortcuts.md +++ b/templates/zerver/help/keyboard-shortcuts.md @@ -20,6 +20,9 @@ Zulip keyboard shortcuts are divided into four categories: ## Composing messages * **Reply to message** `Enter` `r` - This shortcut allows the user to begin replying to the selected message (outlined in blue). * **Reply to author** `R` - This shortcut allows the user to begin writing a private message to the author of the selected message (outlined in blue). +* **Reply to message mentioning the author** `Enter` `@` - This + shortcut allows the user to begin replying to the selected message + (outlined in blue), @-mentioning the author of the selected message. * **New stream message** `c` - This shortcut allows the user to begin composing a new stream message. * **New private message** `C` - This shortcut allows the user to begin composing a new private message. * **Send message** `Tab key` then `Enter` - This shortcut allows the user to send the message that they've written. diff --git a/templates/zerver/keyboard_shortcuts.html b/templates/zerver/keyboard_shortcuts.html index 111d95c9ab..d01256538b 100644 --- a/templates/zerver/keyboard_shortcuts.html +++ b/templates/zerver/keyboard_shortcuts.html @@ -76,6 +76,10 @@ Esc {% trans %}Cancel compose{% endtrans %} + + @ + {% trans %}Compose a reply @-mentioning author{% endtrans %} +