summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-02-13 13:50:08 -0500
committerGitHub <noreply@github.com>2017-02-13 13:50:08 -0500
commit892f8f4651234631a4f83648334cf14f6da323b2 (patch)
tree74234041c8a881e62c49aee3a44a06a23f06b55a /webapp
parent67dd6c1ec6e53923eef892c15a59cc269e9db037 (diff)
downloadchat-892f8f4651234631a4f83648334cf14f6da323b2.tar.gz
chat-892f8f4651234631a4f83648334cf14f6da323b2.tar.bz2
chat-892f8f4651234631a4f83648334cf14f6da323b2.zip
Fix ignore unread and DM unreads (#5391)
* Fix ignoring unreads in channels * Fix DM unreads
Diffstat (limited to 'webapp')
-rw-r--r--webapp/stores/channel_store.jsx9
-rw-r--r--webapp/stores/team_store.jsx11
2 files changed, 16 insertions, 4 deletions
diff --git a/webapp/stores/channel_store.jsx b/webapp/stores/channel_store.jsx
index 488e49492..ba6620750 100644
--- a/webapp/stores/channel_store.jsx
+++ b/webapp/stores/channel_store.jsx
@@ -398,6 +398,11 @@ class ChannelStoreClass extends EventEmitter {
return;
}
+ const member = this.getMyMember(id);
+ if (member && member.notify_props && member.notify_props.mark_unread === NotificationPrefs.MENTION) {
+ return;
+ }
+
this.unreadCounts[id].msgs++;
this.get(id).total_msg_count++;
}
@@ -496,10 +501,10 @@ ChannelStore.dispatchToken = AppDispatcher.register((payload) => {
case ActionTypes.RECEIVED_POST:
var id = action.post.channel_id;
- var teamId = action.websocketMessageProps ? action.websocketMessageProps.team_id : '';
+ var teamId = action.websocketMessageProps ? action.websocketMessageProps.team_id : null;
// Current team and not current channel or the window is inactive
- if (TeamStore.getCurrentId() === teamId && (ChannelStore.getCurrentId() !== id || !window.isActive)) {
+ if ((TeamStore.getCurrentId() === teamId || teamId === '') && (ChannelStore.getCurrentId() !== id || !window.isActive)) {
ChannelStore.incrementMessages(id);
ChannelStore.incrementMentionsIfNeeded(id, action.websocketMessageProps);
ChannelStore.emitChange();
diff --git a/webapp/stores/team_store.jsx b/webapp/stores/team_store.jsx
index e58c79806..af17f7b6f 100644
--- a/webapp/stores/team_store.jsx
+++ b/webapp/stores/team_store.jsx
@@ -4,8 +4,10 @@
import AppDispatcher from '../dispatcher/app_dispatcher.jsx';
import EventEmitter from 'events';
import UserStore from 'stores/user_store.jsx';
+import ChannelStore from 'stores/channel_store.jsx';
import Constants from 'utils/constants.jsx';
+const NotificationPrefs = Constants.NotificationPrefs;
import {getSiteURL} from 'utils/url.jsx';
const ActionTypes = Constants.ActionTypes;
@@ -317,7 +319,12 @@ class TeamStoreClass extends EventEmitter {
}
}
- incrementMessages(id) {
+ incrementMessages(id, channelId) {
+ const channelMember = ChannelStore.getMyMember(channelId);
+ if (channelMember && channelMember.notify_props && channelMember.notify_props.mark_unread === NotificationPrefs.MENTION) {
+ return;
+ }
+
const member = this.my_team_members.filter((m) => m.team_id === id)[0];
member.msg_count++;
}
@@ -390,7 +397,7 @@ TeamStore.dispatchToken = AppDispatcher.register((payload) => {
case ActionTypes.RECEIVED_POST:
var id = action.websocketMessageProps ? action.websocketMessageProps.team_id : '';
if (TeamStore.getCurrentId() !== id && id.length > 0) {
- TeamStore.incrementMessages(id);
+ TeamStore.incrementMessages(id, action.post.channel_id);
TeamStore.incrementMentionsIfNeeded(id, action.websocketMessageProps);
TeamStore.emitChange();
}