diff options
-rw-r--r-- | web/react/stores/channel_store.jsx | 4 | ||||
-rw-r--r-- | web/react/stores/socket_store.jsx | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/web/react/stores/channel_store.jsx b/web/react/stores/channel_store.jsx index d650b23c2..ac800a988 100644 --- a/web/react/stores/channel_store.jsx +++ b/web/react/stores/channel_store.jsx @@ -308,7 +308,7 @@ ChannelStore.dispatchToken = AppDispatcher.register((payload) => { ChannelStore.storeChannels(action.channels); ChannelStore.storeChannelMembers(action.members); currentId = ChannelStore.getCurrentId(); - if (currentId) { + if (currentId && !document.hidden) { ChannelStore.resetCounts(currentId); } ChannelStore.setUnreadCounts(); @@ -321,7 +321,7 @@ ChannelStore.dispatchToken = AppDispatcher.register((payload) => { ChannelStore.pStoreChannelMember(action.member); } currentId = ChannelStore.getCurrentId(); - if (currentId) { + if (currentId && !document.hidden) { ChannelStore.resetCounts(currentId); } ChannelStore.setUnreadCount(action.channel.id); diff --git a/web/react/stores/socket_store.jsx b/web/react/stores/socket_store.jsx index bc2bdbe64..e1b65fe14 100644 --- a/web/react/stores/socket_store.jsx +++ b/web/react/stores/socket_store.jsx @@ -188,7 +188,9 @@ function handleNewPostEvent(msg, translations) { // Update channel state if (ChannelStore.getCurrentId() === msg.channel_id) { - if (window.isActive) { + if (document.hidden) { + AsyncClient.getChannel(msg.channel_id); + } else { AsyncClient.updateLastViewedAt(); } } else if (UserStore.getCurrentId() !== msg.user_id || post.type !== Constants.POST_TYPE_JOIN_LEAVE) { |