summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaturnino Abril <saturnino.abril@gmail.com>2017-06-03 00:11:03 +0800
committerChristopher Speller <crspeller@gmail.com>2017-06-02 09:11:03 -0700
commitf1b317a51fcadfd5feab9e4c496195e0cacba8c9 (patch)
treecb789b68cc5a09a41d03131c56dd44a3ec3a6098
parent6a54f3c4890135ea925365e59628afbb58ff6f87 (diff)
downloadchat-f1b317a51fcadfd5feab9e4c496195e0cacba8c9.tar.gz
chat-f1b317a51fcadfd5feab9e4c496195e0cacba8c9.tar.bz2
chat-f1b317a51fcadfd5feab9e4c496195e0cacba8c9.zip
add shortcut that opens a comment thread for most recent message in a channel (#6549)
-rw-r--r--app/command_shortcuts.go3
-rw-r--r--i18n/en.json4
-rw-r--r--webapp/components/create_post.jsx10
3 files changed, 16 insertions, 1 deletions
diff --git a/app/command_shortcuts.go b/app/command_shortcuts.go
index e3c342af1..da3537961 100644
--- a/app/command_shortcuts.go
+++ b/app/command_shortcuts.go
@@ -37,7 +37,7 @@ func (me *ShortcutsProvider) GetCommand(T goi18n.TranslateFunc) *model.Command {
}
func (me *ShortcutsProvider) DoCommand(args *model.CommandArgs, message string) *model.CommandResponse {
- shortcutIds := [28]string{
+ shortcutIds := [29]string{
"api.command_shortcuts.header",
// Nav shortcuts
"api.command_shortcuts.nav.header",
@@ -58,6 +58,7 @@ func (me *ShortcutsProvider) DoCommand(args *model.CommandArgs, message string)
"api.command_shortcuts.msgs.reprint_prev",
"api.command_shortcuts.msgs.reprint_next",
"api.command_shortcuts.msgs.edit",
+ "api.command_shortcuts.msgs.reply",
"api.command_shortcuts.msgs.comp_username",
"api.command_shortcuts.msgs.comp_channel",
"api.command_shortcuts.msgs.comp_emoji",
diff --git a/i18n/en.json b/i18n/en.json
index b71c1e915..7922115b0 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -748,6 +748,10 @@
"translation": "UP (in empty input field): Edit your last message in the current channel\n"
},
{
+ "id": "api.command_shortcuts.msgs.reply",
+ "translation": "SHIFT+UP (in empty input field): Reply to the most recent message in the current channel\n"
+ },
+ {
"id": "api.command_shortcuts.msgs.header",
"translation": "#### Messages\n\n"
},
diff --git a/webapp/components/create_post.jsx b/webapp/components/create_post.jsx
index 22fba0e73..74104cf2a 100644
--- a/webapp/components/create_post.jsx
+++ b/webapp/components/create_post.jsx
@@ -529,6 +529,16 @@ export default class CreatePost extends React.Component {
channelId: lastPost.channel_id,
comments: PostStore.getCommentCount(lastPost)
});
+ } else if (!e.ctrlKey && !e.metaKey && !e.altKey && e.shiftKey && e.keyCode === KeyCodes.UP && this.state.message === '') {
+ e.preventDefault();
+ if (document.createEvent) {
+ var evt = document.createEvent('MouseEvents');
+ evt.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
+ document.getElementById('commentIcon0').dispatchEvent(evt);
+ } else if (document.createEventObject) {
+ var evObj = document.createEventObject();
+ document.getElementById('commentIcon0').fireEvent('onclick', evObj);
+ }
}
if ((e.ctrlKey || e.metaKey) && !e.altKey && !e.shiftKey && (e.keyCode === Constants.KeyCodes.UP || e.keyCode === Constants.KeyCodes.DOWN)) {