summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-02-15 21:06:13 -0500
committerCorey Hulen <corey@hulen.com>2017-02-15 21:06:13 -0500
commite505577abf64e1a879e834619668cebe839eb190 (patch)
tree3a5a57addf3b0d712ebf2c72c5b86538d5ca73bb /webapp
parent01a8114aa3d0a349e3b389ecc1e979c4123dee75 (diff)
downloadchat-e505577abf64e1a879e834619668cebe839eb190.tar.gz
chat-e505577abf64e1a879e834619668cebe839eb190.tar.bz2
chat-e505577abf64e1a879e834619668cebe839eb190.zip
Clean-up unread counting and fix commenting (#5437)
Diffstat (limited to 'webapp')
-rw-r--r--webapp/stores/channel_store.jsx16
1 files changed, 13 insertions, 3 deletions
diff --git a/webapp/stores/channel_store.jsx b/webapp/stores/channel_store.jsx
index ab015d434..6a012c600 100644
--- a/webapp/stores/channel_store.jsx
+++ b/webapp/stores/channel_store.jsx
@@ -9,6 +9,7 @@ import UserStore from 'stores/user_store.jsx';
var Utils;
import {ActionTypes, Constants} from 'utils/constants.jsx';
+import {isSystemMessage} from 'utils/post_utils.jsx';
const NotificationPrefs = Constants.NotificationPrefs;
const PostTypes = Constants.PostTypes;
@@ -510,13 +511,17 @@ ChannelStore.dispatchToken = AppDispatcher.register((payload) => {
return;
}
+ if (action.post.user_id === UserStore.getCurrentId() && !isSystemMessage(action.post)) {
+ return;
+ }
+
var id = action.post.channel_id;
var teamId = action.websocketMessageProps ? action.websocketMessageProps.team_id : null;
+ var markRead = id === ChannelStore.getCurrentId() && window.isActive;
- // Current team and not current channel or the window is inactive
- if ((TeamStore.getCurrentId() === teamId || teamId === '') && (ChannelStore.getCurrentId() !== id || !window.isActive)) {
- ChannelStore.incrementMessages(id, action.post.user_id === UserStore.getCurrentId());
+ if (TeamStore.getCurrentId() === teamId || teamId === '') {
ChannelStore.incrementMentionsIfNeeded(id, action.websocketMessageProps);
+ ChannelStore.incrementMessages(id, markRead);
ChannelStore.emitChange();
}
break;
@@ -526,6 +531,11 @@ ChannelStore.dispatchToken = AppDispatcher.register((payload) => {
ChannelStore.emitChange();
break;
+ case ActionTypes.CREATE_COMMENT:
+ ChannelStore.incrementMessages(action.post.channel_id, true);
+ ChannelStore.emitChange();
+ break;
+
default:
break;
}