summaryrefslogtreecommitdiffstats
path: root/webapp/actions/channel_actions.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/actions/channel_actions.jsx')
-rw-r--r--webapp/actions/channel_actions.jsx12
1 files changed, 12 insertions, 0 deletions
diff --git a/webapp/actions/channel_actions.jsx b/webapp/actions/channel_actions.jsx
index 9e5ecb03b..f8bc61538 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) {
@@ -24,3 +26,13 @@ export function goToChannel(channel) {
export function executeCommand(channelId, message, suggest, success, error) {
Client.executeCommand(channelId, message, 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);
+ }
+}