summaryrefslogtreecommitdiffstats
path: root/webapp/stores/channel_store.jsx
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2016-11-11 14:55:05 -0500
committerHarrison Healey <harrisonmhealey@gmail.com>2016-11-11 14:55:05 -0500
commitced5f54500b2688a942c5c1afbb4fca3882b4f51 (patch)
treefa4cd9d8cab4e9b93a31102c90f22b98f9c75c8d /webapp/stores/channel_store.jsx
parent29efeff09532397a33bb971e91324f673b296559 (diff)
downloadchat-ced5f54500b2688a942c5c1afbb4fca3882b4f51.tar.gz
chat-ced5f54500b2688a942c5c1afbb4fca3882b4f51.tar.bz2
chat-ced5f54500b2688a942c5c1afbb4fca3882b4f51.zip
Fixing new messages indicator (#4531)
Diffstat (limited to 'webapp/stores/channel_store.jsx')
-rw-r--r--webapp/stores/channel_store.jsx17
1 files changed, 16 insertions, 1 deletions
diff --git a/webapp/stores/channel_store.jsx b/webapp/stores/channel_store.jsx
index 13a5c4574..136423d45 100644
--- a/webapp/stores/channel_store.jsx
+++ b/webapp/stores/channel_store.jsx
@@ -263,6 +263,12 @@ class ChannelStoreClass extends EventEmitter {
});
}
+ setUnreadCountsByCurrentMembers() {
+ Object.keys(this.myChannelMembers).forEach((key) => {
+ this.setUnreadCountByChannel(this.myChannelMembers[key].channel_id);
+ });
+ }
+
setUnreadCountsByChannels(channels) {
channels.forEach((c) => {
this.setUnreadCountByChannel(c.id);
@@ -368,6 +374,15 @@ ChannelStore.dispatchToken = AppDispatcher.register((payload) => {
ChannelStore.setUnreadCountsByMembers(action.members);
ChannelStore.emitChange();
break;
+ case ActionTypes.RECEIVED_CHANNEL_MEMBER:
+ ChannelStore.storeMyChannelMember(action.member);
+ currentId = ChannelStore.getCurrentId();
+ if (currentId && window.isActive) {
+ ChannelStore.resetCounts(currentId);
+ }
+ ChannelStore.setUnreadCountsByCurrentMembers();
+ ChannelStore.emitChange();
+ break;
case ActionTypes.RECEIVED_MORE_CHANNELS:
ChannelStore.storeMoreChannels(action.channels);
ChannelStore.emitChange();
@@ -385,4 +400,4 @@ ChannelStore.dispatchToken = AppDispatcher.register((payload) => {
}
});
-export default ChannelStore; \ No newline at end of file
+export default ChannelStore;