summaryrefslogtreecommitdiffstats
path: root/web/react/stores
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2016-02-12 14:23:12 -0500
committerJoramWilander <jwawilander@gmail.com>2016-02-12 14:23:12 -0500
commitc861a24d48d2cb5417f704eca7d28db7637275f6 (patch)
treef958ccda0970acd32b569c7734452b369dfee8d9 /web/react/stores
parent6cb4f82ee5a17cd1d32ae19c266b78c2cfd604e6 (diff)
downloadchat-c861a24d48d2cb5417f704eca7d28db7637275f6.tar.gz
chat-c861a24d48d2cb5417f704eca7d28db7637275f6.tar.bz2
chat-c861a24d48d2cb5417f704eca7d28db7637275f6.zip
Fix badge and tab */(1) not disappearing until switching away from channel
Diffstat (limited to 'web/react/stores')
-rw-r--r--web/react/stores/channel_store.jsx4
-rw-r--r--web/react/stores/socket_store.jsx6
2 files changed, 5 insertions, 5 deletions
diff --git a/web/react/stores/channel_store.jsx b/web/react/stores/channel_store.jsx
index ac800a988..60cb10de7 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 && !document.hidden) {
+ if (currentId && window.isActive) {
ChannelStore.resetCounts(currentId);
}
ChannelStore.setUnreadCounts();
@@ -321,7 +321,7 @@ ChannelStore.dispatchToken = AppDispatcher.register((payload) => {
ChannelStore.pStoreChannelMember(action.member);
}
currentId = ChannelStore.getCurrentId();
- if (currentId && !document.hidden) {
+ if (currentId && window.isActive) {
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 424c7fe57..efb57e226 100644
--- a/web/react/stores/socket_store.jsx
+++ b/web/react/stores/socket_store.jsx
@@ -202,10 +202,10 @@ function handleNewPostEvent(msg, translations) {
// Update channel state
if (ChannelStore.getCurrentId() === msg.channel_id) {
- if (document.hidden) {
- AsyncClient.getChannel(msg.channel_id);
- } else {
+ if (window.isActive) {
AsyncClient.updateLastViewedAt();
+ } else {
+ AsyncClient.getChannel(msg.channel_id);
}
} else if (UserStore.getCurrentId() !== msg.user_id || post.type !== Constants.POST_TYPE_JOIN_LEAVE) {
AsyncClient.getChannel(msg.channel_id);