diff options
author | Chris <ccbrown112@gmail.com> | 2017-06-23 15:47:24 -0700 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2017-06-23 15:47:24 -0700 |
commit | 4df36a504cebc61fa1e5e6f7980f9245b475facf (patch) | |
tree | f6d6d8a6093dc7934cbd0b84be950d1595d9395e /webapp/actions/channel_actions.jsx | |
parent | bf12e7e32cef427edacbd512d067c2bfd35d3b67 (diff) | |
download | chat-4df36a504cebc61fa1e5e6f7980f9245b475facf.tar.gz chat-4df36a504cebc61fa1e5e6f7980f9245b475facf.tar.bz2 chat-4df36a504cebc61fa1e5e6f7980f9245b475facf.zip |
PLT-6714: add /settings command (#6716)
* add /settings command
* update receiver name
Diffstat (limited to 'webapp/actions/channel_actions.jsx')
-rw-r--r-- | webapp/actions/channel_actions.jsx | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/webapp/actions/channel_actions.jsx b/webapp/actions/channel_actions.jsx index e756275bc..3a01c4089 100644 --- a/webapp/actions/channel_actions.jsx +++ b/webapp/actions/channel_actions.jsx @@ -9,6 +9,8 @@ import ChannelStore from 'stores/channel_store.jsx'; import * as ChannelUtils from 'utils/channel_utils.jsx'; import PreferenceStore from 'stores/preference_store.jsx'; +import * as GlobalActions from 'actions/global_actions.jsx'; + import {loadProfilesForSidebar, loadNewDMIfNeeded, loadNewGMIfNeeded} from 'actions/user_actions.jsx'; import {trackEvent} from 'actions/diagnostics_actions.jsx'; @@ -66,9 +68,15 @@ export function goToChannel(channel) { export function executeCommand(message, args, success, error) { let msg = message; - msg = msg.substring(0, msg.indexOf(' ')).toLowerCase() + msg.substring(msg.indexOf(' '), msg.length); + let cmdLength = msg.indexOf(' '); + if (cmdLength < 0) { + cmdLength = msg.length; + } + const cmd = msg.substring(0, cmdLength).toLowerCase(); + msg = cmd + msg.substring(cmdLength, msg.length); - if (message.indexOf('/shortcuts') !== -1) { + switch (cmd) { + case '/shortcuts': if (UserAgent.isMobile()) { const err = {message: Utils.localizeMessage('create_post.shortcutsNotSupported', 'Keyboard shortcuts are not supported on your device')}; error(err); @@ -78,7 +86,12 @@ export function executeCommand(message, args, success, error) { } else if (message.indexOf('mac') !== -1) { msg = '/shortcuts'; } + break; + case '/settings': + GlobalActions.showAccountSettingsModal(); + return; } + Client.executeCommand(msg, args, success, (err) => { AsyncClient.dispatchError(err, 'executeCommand'); @@ -86,7 +99,8 @@ export function executeCommand(message, args, success, error) { if (error) { error(err); } - }); + } + ); } export function setChannelAsRead(channelIdParam) { |