diff options
Diffstat (limited to 'webapp/actions/channel_actions.jsx')
-rw-r--r-- | webapp/actions/channel_actions.jsx | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/webapp/actions/channel_actions.jsx b/webapp/actions/channel_actions.jsx index 9e5ecb03b..a590f9a9b 100644 --- a/webapp/actions/channel_actions.jsx +++ b/webapp/actions/channel_actions.jsx @@ -5,6 +5,8 @@ import {browserHistory} from 'react-router/es6'; import * as Utils from 'utils/utils.jsx'; import TeamStore from 'stores/team_store.jsx'; import UserStore from 'stores/user_store.jsx'; +import ChannelStore from 'stores/channel_store.jsx'; +import * as AsyncClient from 'utils/async_client.jsx'; import Client from 'utils/web_client.jsx'; export function goToChannel(channel) { @@ -22,5 +24,27 @@ export function goToChannel(channel) { } export function executeCommand(channelId, message, suggest, success, error) { - Client.executeCommand(channelId, message, suggest, success, error); + let msg = message; + + msg = msg.substring(0, msg.indexOf(' ')).toLowerCase() + msg.substring(msg.indexOf(' '), msg.length); + + if (message.indexOf('/shortcuts') !== -1 && Utils.isMac()) { + msg += ' mac'; + } + + if (!Utils.isMac() && message.indexOf('/shortcuts') !== -1 && message.indexOf('mac') !== -1) { + msg = '/shortcuts'; + } + + Client.executeCommand(channelId, msg, suggest, success, error); +} + +export function setChannelAsRead(channelIdParam) { + const channelId = channelIdParam || ChannelStore.getCurrentId(); + AsyncClient.updateLastViewedAt(); + ChannelStore.resetCounts(channelId); + ChannelStore.emitChange(); + if (channelId === ChannelStore.getCurrentId()) { + ChannelStore.emitLastViewed(Number.MAX_VALUE, false); + } } |