summaryrefslogtreecommitdiffstats
path: root/webapp/root.jsx
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-06-05 12:49:38 -0400
committerGitHub <noreply@github.com>2017-06-05 12:49:38 -0400
commitabd0466a42d6b9897ba9e3bcb373b41974e9c46f (patch)
treeaee90a2041d243ed4094b7180db0642f73b57e82 /webapp/root.jsx
parent0f3bd85b8dddc6805e260a9d19cadcc603a12e17 (diff)
downloadchat-abd0466a42d6b9897ba9e3bcb373b41974e9c46f.tar.gz
chat-abd0466a42d6b9897ba9e3bcb373b41974e9c46f.tar.bz2
chat-abd0466a42d6b9897ba9e3bcb373b41974e9c46f.zip
PLT-3466 E10: Add announcement bar feature (#6509)
* E10 - Add announcement bar feature * Updates per feedback * Add component tests and snapshots * Update snapshots * Updating color picker UI (#6543) * Add class to body tag when banner is not dismissable and clean up localstorage items when banner changes * Fixing links (#6544) * Updating UI for fixed error bar (#6552) * Truncating text on fixed banner (#6561) * Plt 3466 - Error bar link states (#6577) * Updating error bar hover state * Updating error bar link states
Diffstat (limited to 'webapp/root.jsx')
-rw-r--r--webapp/root.jsx16
1 files changed, 11 insertions, 5 deletions
diff --git a/webapp/root.jsx b/webapp/root.jsx
index 6c7643f17..161eff48e 100644
--- a/webapp/root.jsx
+++ b/webapp/root.jsx
@@ -25,9 +25,11 @@ import 'katex/dist/katex.min.css';
import store from 'stores/redux_store.jsx';
const dispatch = store.dispatch;
const getState = store.getState;
+import EventEmitter from 'mattermost-redux/utils/event_emitter';
import {viewChannel} from 'mattermost-redux/actions/channels';
-import {getClientConfig, getLicenseConfig, setUrl} from 'mattermost-redux/actions/general';
+import {getClientConfig, getLicenseConfig, setUrl, setServerVersion as setServerVersionRedux} from 'mattermost-redux/actions/general';
+import {General} from 'mattermost-redux/constants';
// Import the root of our routing tree
import rRoot from 'routes/route_root.jsx';
@@ -128,15 +130,19 @@ function renderRootComponent() {
let serverVersion = '';
-store.subscribe(() => {
- const newServerVersion = getState().entities.general.serverVersion;
+EventEmitter.on(General.CONFIG_CHANGED, setServerVersion);
+
+function setServerVersion(newServerVersion) {
if (serverVersion && serverVersion !== newServerVersion) {
console.log('Detected version update refreshing the page'); //eslint-disable-line no-console
window.location.reload(true);
}
- serverVersion = newServerVersion;
-});
+ if (serverVersion !== newServerVersion) {
+ serverVersion = newServerVersion;
+ setServerVersionRedux(newServerVersion)(dispatch, getState);
+ }
+}
global.window.setup_root = () => {
// Do the pre-render setup and call renderRootComponent when done