summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaturnino Abril <saturnino.abril@gmail.com>2017-06-05 20:46:31 +0800
committerHarrison Healey <harrisonmhealey@gmail.com>2017-06-05 08:46:31 -0400
commit0d6dd52be600d5b32ad84c9d26720d36cd96bc3e (patch)
treef4745ac90bffbec068773fb4160a9a467acbe72b
parentfd6f6a55ceb38f4ecf105a50464fb1a57226c947 (diff)
downloadchat-0d6dd52be600d5b32ad84c9d26720d36cd96bc3e.tar.gz
chat-0d6dd52be600d5b32ad84c9d26720d36cd96bc3e.tar.bz2
chat-0d6dd52be600d5b32ad84c9d26720d36cd96bc3e.zip
[PLT-6697] Added CTRL/CMD+SHIFT+K shortcut to open 'more direct messages' dialog (#6534)
* add keypress shortcut to open 'more direct messages' dialog * removed duplicate e.preventDefault() * add text description to /shortcuts output
-rw-r--r--app/command_shortcuts.go1
-rw-r--r--i18n/en.json4
-rw-r--r--webapp/components/navbar.jsx2
-rw-r--r--webapp/components/sidebar.jsx13
4 files changed, 15 insertions, 5 deletions
diff --git a/app/command_shortcuts.go b/app/command_shortcuts.go
index da3537961..547d8155f 100644
--- a/app/command_shortcuts.go
+++ b/app/command_shortcuts.go
@@ -47,6 +47,7 @@ func (me *ShortcutsProvider) DoCommand(args *model.CommandArgs, message string)
"api.command_shortcuts.nav.unread_next",
"api.command_shortcuts.nav.switcher",
"api.command_shortcuts.nav.switcher_team",
+ "api.command_shortcuts.nav.direct_messages_menu",
"api.command_shortcuts.nav.settings",
"api.command_shortcuts.nav.recent_mentions",
// Files shortcuts
diff --git a/i18n/en.json b/i18n/en.json
index 7922115b0..4674f3fb2 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -800,6 +800,10 @@
"translation": "{{.CmdOrCtrl}}+ALT+K: Open a quick team switcher dialog\n"
},
{
+ "id": "api.command_shortcuts.nav.direct_messages_menu",
+ "translation": "{{.CmdOrCtrl}}+SHIFT+K: Open direct messages menu\n"
+ },
+ {
"id": "api.command_shortcuts.nav.unread_next",
"translation": "ALT+SHIFT+DOWN: Next channel or direct message in left hand sidebar with unread messages\n"
},
diff --git a/webapp/components/navbar.jsx b/webapp/components/navbar.jsx
index 948649b45..6f8df3709 100644
--- a/webapp/components/navbar.jsx
+++ b/webapp/components/navbar.jsx
@@ -220,7 +220,7 @@ export default class Navbar extends React.Component {
}
handleQuickSwitchKeyPress(e) {
- if (Utils.cmdOrCtrlPressed(e, true) && e.keyCode === Constants.KeyCodes.K) {
+ if (Utils.cmdOrCtrlPressed(e, true) && !e.shiftKey && e.keyCode === Constants.KeyCodes.K) {
e.preventDefault();
if (e.altKey) {
if (getMyTeams(store.getState()).length <= 1) {
diff --git a/webapp/components/sidebar.jsx b/webapp/components/sidebar.jsx
index 5674e8c75..0988101d8 100644
--- a/webapp/components/sidebar.jsx
+++ b/webapp/components/sidebar.jsx
@@ -68,6 +68,7 @@ export default class Sidebar extends React.Component {
this.hideNewChannelModal = this.hideNewChannelModal.bind(this);
this.showMoreDirectChannelsModal = this.showMoreDirectChannelsModal.bind(this);
this.hideMoreDirectChannelsModal = this.hideMoreDirectChannelsModal.bind(this);
+ this.handleOpenMoreDirectChannelsModal = this.handleOpenMoreDirectChannelsModal.bind(this);
this.createChannelElement = this.createChannelElement.bind(this);
this.updateTitle = this.updateTitle.bind(this);
@@ -200,6 +201,11 @@ export default class Sidebar extends React.Component {
this.showMoreDirectChannelsModal(args.startingUsers);
}
+ handleOpenMoreDirectChannelsModal(e) {
+ e.preventDefault();
+ this.showMoreDirectChannelsModal();
+ }
+
onChange() {
if (this.state.currentTeam.id !== TeamStore.getCurrentId()) {
ChannelStore.clear();
@@ -301,6 +307,8 @@ export default class Sidebar extends React.Component {
ChannelActions.goToChannel(nextChannel);
this.updateScrollbarOnChannelChange(nextChannel);
this.isSwitchingChannel = false;
+ } else if (Utils.cmdOrCtrlPressed(e) && e.shiftKey && e.keyCode === Constants.KeyCodes.K) {
+ this.handleOpenMoreDirectChannelsModal(e);
}
}
@@ -681,10 +689,7 @@ export default class Sidebar extends React.Component {
<li key='more'>
<a
href='#'
- onClick={(e) => {
- e.preventDefault();
- this.showMoreDirectChannelsModal();
- }}
+ onClick={this.handleOpenMoreDirectChannelsModal}
>
<FormattedMessage
id='sidebar.moreElips'