From c861a24d48d2cb5417f704eca7d28db7637275f6 Mon Sep 17 00:00:00 2001
From: JoramWilander <jwawilander@gmail.com>
Date: Fri, 12 Feb 2016 14:23:12 -0500
Subject: Fix badge and tab */(1) not disappearing until switching away from
 channel

---
 web/react/stores/socket_store.jsx | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'web/react/stores/socket_store.jsx')

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);
-- 
cgit v1.2.3-1-g7c22

