From 49481caf6db89b0853626ac52ab5f786a6887179 Mon Sep 17 00:00:00 2001
From: Joram Wilander <jwawilander@gmail.com>
Date: Thu, 4 May 2017 15:45:19 -0400
Subject: PLT-6262 Add config setting to disable file attachments (#6301)

* Add config setting to disable file attachments

* Add unit tests

* Updating UI for no attachments (#6312)

* Update UI text on file upload System Console setting (#6313)

* Update storage_settings.jsx

* Update en.json
---
 webapp/root.jsx | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

(limited to 'webapp/root.jsx')

diff --git a/webapp/root.jsx b/webapp/root.jsx
index 6a63e6dad..03595f85c 100644
--- a/webapp/root.jsx
+++ b/webapp/root.jsx
@@ -12,7 +12,6 @@ import PDFJS from 'pdfjs-dist';
 
 import * as Websockets from 'actions/websocket_actions.jsx';
 import {loadMeAndConfig} from 'actions/user_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';
@@ -86,7 +85,6 @@ function preRenderSetup(callwhendone) {
          () => {
              // Turn off to prevent getting stuck in a loop
              $(window).off('beforeunload');
-             BrowserStore.setLastServerVersion('');
              if (UserStore.getCurrentUser()) {
                  viewChannel('', ChannelStore.getCurrentId() || '')(dispatch, getState);
              }
@@ -120,6 +118,18 @@ function renderRootComponent() {
     document.getElementById('root'));
 }
 
+let serverVersion = '';
+
+store.subscribe(() => {
+    const newServerVersion = getState().entities.general.serverVersion;
+    if (serverVersion && serverVersion !== newServerVersion) {
+        console.log('Detected version update refreshing the page'); //eslint-disable-line no-console
+        window.location.reload(true);
+    }
+
+    serverVersion = newServerVersion;
+});
+
 global.window.setup_root = () => {
     // Do the pre-render setup and call renderRootComponent when done
     preRenderSetup(renderRootComponent);
-- 
cgit v1.2.3-1-g7c22

