From db2966b7cb3111ff1b3cadfbec1221343b0e8629 Mon Sep 17 00:00:00 2001
From: Joram Wilander <jwawilander@gmail.com>
Date: Wed, 15 Feb 2017 18:54:24 -0500
Subject: Remove MakeDirectChannelVisible and add client handling for showing
 DMs (#5430)

---
 webapp/root.jsx | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'webapp/root.jsx')

diff --git a/webapp/root.jsx b/webapp/root.jsx
index 93cfa5a38..98c744477 100644
--- a/webapp/root.jsx
+++ b/webapp/root.jsx
@@ -12,6 +12,7 @@ import * as GlobalActions from 'actions/global_actions.jsx';
 import * as Websockets from 'actions/websocket_actions.jsx';
 import BrowserStore from 'stores/browser_store.jsx';
 import ChannelStore from 'stores/channel_store.jsx';
+import UserStore from 'stores/user_store.jsx';
 import * as I18n from 'i18n/i18n.jsx';
 import * as AsyncClient from 'utils/async_client.jsx';
 
@@ -60,7 +61,9 @@ function preRenderSetup(callwhendone) {
     $(window).on('beforeunload',
          () => {
              BrowserStore.setLastServerVersion('');
-             AsyncClient.viewChannel('', ChannelStore.getCurrentId() || '');
+             if (UserStore.getCurrentUser()) {
+                 AsyncClient.viewChannel('', ChannelStore.getCurrentId() || '');
+             }
              Websockets.close();
          }
     );
-- 
cgit v1.2.3-1-g7c22

