summaryrefslogtreecommitdiffstats
path: root/web/react/stores
diff options
context:
space:
mode:
authorJack <jackdeng@gmail.com>2015-09-22 08:16:51 -0700
committerJack <jackdeng@gmail.com>2015-09-22 08:16:51 -0700
commit602bed85f2b32733f73e2edddb542fa36baac462 (patch)
tree06a6ee9b609a9122bc2f0e6f6e6300f9ba79a3aa /web/react/stores
parenta31868336f97a91bfd5a7e91e99a9b294d131f90 (diff)
parentf439c82d7c885b4c530ba9da0a41b17910743b55 (diff)
downloadchat-602bed85f2b32733f73e2edddb542fa36baac462.tar.gz
chat-602bed85f2b32733f73e2edddb542fa36baac462.tar.bz2
chat-602bed85f2b32733f73e2edddb542fa36baac462.zip
fix conflict
Diffstat (limited to 'web/react/stores')
-rw-r--r--web/react/stores/admin_store.jsx30
-rw-r--r--web/react/stores/browser_store.jsx7
2 files changed, 32 insertions, 5 deletions
diff --git a/web/react/stores/admin_store.jsx b/web/react/stores/admin_store.jsx
index 591b52d05..dd5b60a24 100644
--- a/web/react/stores/admin_store.jsx
+++ b/web/react/stores/admin_store.jsx
@@ -8,16 +8,22 @@ var Constants = require('../utils/constants.jsx');
var ActionTypes = Constants.ActionTypes;
var LOG_CHANGE_EVENT = 'log_change';
+var CONFIG_CHANGE_EVENT = 'config_change';
class AdminStoreClass extends EventEmitter {
constructor() {
super();
this.logs = null;
+ this.config = null;
this.emitLogChange = this.emitLogChange.bind(this);
this.addLogChangeListener = this.addLogChangeListener.bind(this);
this.removeLogChangeListener = this.removeLogChangeListener.bind(this);
+
+ this.emitConfigChange = this.emitConfigChange.bind(this);
+ this.addConfigChangeListener = this.addConfigChangeListener.bind(this);
+ this.removeConfigChangeListener = this.removeConfigChangeListener.bind(this);
}
emitLogChange() {
@@ -32,6 +38,18 @@ class AdminStoreClass extends EventEmitter {
this.removeListener(LOG_CHANGE_EVENT, callback);
}
+ emitConfigChange() {
+ this.emit(CONFIG_CHANGE_EVENT);
+ }
+
+ addConfigChangeListener(callback) {
+ this.on(CONFIG_CHANGE_EVENT, callback);
+ }
+
+ removeConfigChangeListener(callback) {
+ this.removeListener(CONFIG_CHANGE_EVENT, callback);
+ }
+
getLogs() {
return this.logs;
}
@@ -39,6 +57,14 @@ class AdminStoreClass extends EventEmitter {
saveLogs(logs) {
this.logs = logs;
}
+
+ getConfig() {
+ return this.config;
+ }
+
+ saveConfig(config) {
+ this.config = config;
+ }
}
var AdminStore = new AdminStoreClass();
@@ -51,6 +77,10 @@ AdminStoreClass.dispatchToken = AppDispatcher.register((payload) => {
AdminStore.saveLogs(action.logs);
AdminStore.emitLogChange();
break;
+ case ActionTypes.RECIEVED_CONFIG:
+ AdminStore.saveConfig(action.config);
+ AdminStore.emitConfigChange();
+ break;
default:
}
});
diff --git a/web/react/stores/browser_store.jsx b/web/react/stores/browser_store.jsx
index e1ca52746..d2dedb271 100644
--- a/web/react/stores/browser_store.jsx
+++ b/web/react/stores/browser_store.jsx
@@ -9,9 +9,6 @@ function getPrefix() {
return UserStore.getCurrentId() + '_';
}
-// Also change model/utils.go ETAG_ROOT_VERSION
-var BROWSER_STORE_VERSION = '.5';
-
class BrowserStoreClass {
constructor() {
this.getItem = this.getItem.bind(this);
@@ -25,9 +22,9 @@ class BrowserStoreClass {
this.isLocalStorageSupported = this.isLocalStorageSupported.bind(this);
var currentVersion = localStorage.getItem('local_storage_version');
- if (currentVersion !== BROWSER_STORE_VERSION) {
+ if (currentVersion !== global.window.config.Version) {
this.clear();
- localStorage.setItem('local_storage_version', BROWSER_STORE_VERSION);
+ localStorage.setItem('local_storage_version', global.window.config.Version);
}
}