summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--webapp/actions/global_actions.jsx4
-rw-r--r--webapp/stores/team_store.jsx8
2 files changed, 12 insertions, 0 deletions
diff --git a/webapp/actions/global_actions.jsx b/webapp/actions/global_actions.jsx
index efff5076a..37020f500 100644
--- a/webapp/actions/global_actions.jsx
+++ b/webapp/actions/global_actions.jsx
@@ -55,6 +55,10 @@ export function emitChannelClickEvent(channel) {
loadPosts(chan.id);
});
+ // Subtract mentions for the team
+ const {msgs, mentions} = ChannelStore.getUnreadCounts()[chan.id] || {msgs: 0, mentions: 0};
+ TeamStore.subtractUnread(chan.team_id, msgs, mentions);
+
// Mark previous and next channel as read
ChannelStore.resetCounts(oldChannelId);
ChannelStore.resetCounts(chan.id);
diff --git a/webapp/stores/team_store.jsx b/webapp/stores/team_store.jsx
index 46f84bc1f..1601a684a 100644
--- a/webapp/stores/team_store.jsx
+++ b/webapp/stores/team_store.jsx
@@ -321,6 +321,14 @@ class TeamStoreClass extends EventEmitter {
}
}
+ subtractUnread(teamId, msgs, mentions) {
+ const member = this.my_team_members.filter((m) => m.team_id === teamId)[0];
+ if (member) {
+ member.msg_count -= msgs;
+ member.mention_count -= mentions;
+ }
+ }
+
incrementMessages(id, channelId) {
const channelMember = ChannelStore.getMyMember(channelId);
if (channelMember && channelMember.notify_props && channelMember.notify_props.mark_unread === NotificationPrefs.MENTION) {