summaryrefslogtreecommitdiffstats
path: root/web/react/stores
diff options
context:
space:
mode:
Diffstat (limited to 'web/react/stores')
-rw-r--r--web/react/stores/browser_store.jsx2
-rw-r--r--web/react/stores/post_store.jsx12
-rw-r--r--web/react/stores/team_store.jsx9
-rw-r--r--web/react/stores/user_store.jsx29
4 files changed, 29 insertions, 23 deletions
diff --git a/web/react/stores/browser_store.jsx b/web/react/stores/browser_store.jsx
index 4d6eb0b8d..4eed754cc 100644
--- a/web/react/stores/browser_store.jsx
+++ b/web/react/stores/browser_store.jsx
@@ -8,7 +8,7 @@ function getPrefix() {
}
// Also change model/utils.go ETAG_ROOT_VERSION
-var BROWSER_STORE_VERSION = '.3';
+var BROWSER_STORE_VERSION = '.4';
module.exports = {
_initialized: false,
diff --git a/web/react/stores/post_store.jsx b/web/react/stores/post_store.jsx
index e773bb688..5280bfe08 100644
--- a/web/react/stores/post_store.jsx
+++ b/web/react/stores/post_store.jsx
@@ -151,12 +151,12 @@ var PostStore = assign({}, EventEmitter.prototype, {
return BrowserStore.getItem("draft_" + channel_id + "_" + user_id);
},
clearDraftUploads: function() {
- BrowserStore.actionOnItemsWithPrefix("draft_", function (key, value) {
- if (value) {
- value.uploadsInProgress = 0;
- BrowserStore.setItem(key, value);
- }
- });
+ BrowserStore.actionOnItemsWithPrefix("draft_", function (key, value) {
+ if (value) {
+ value.uploadsInProgress = 0;
+ BrowserStore.setItem(key, value);
+ }
+ });
}
});
diff --git a/web/react/stores/team_store.jsx b/web/react/stores/team_store.jsx
index b7199a4a8..3f12725f8 100644
--- a/web/react/stores/team_store.jsx
+++ b/web/react/stores/team_store.jsx
@@ -57,10 +57,13 @@ var TeamStore = assign({}, EventEmitter.prototype, {
else
return null;
},
+ getCurrentTeamUrl: function() {
+ return window.location.origin + "/" + this.getCurrent().name;
+ },
storeTeam: function(team) {
- var teams = this._getTeams();
- teams[team.id] = team;
- this._storeTeams(teams);
+ var teams = this._getTeams();
+ teams[team.id] = team;
+ this._storeTeams(teams);
},
_storeTeams: function(teams) {
BrowserStore.setItem("user_teams", teams);
diff --git a/web/react/stores/user_store.jsx b/web/react/stores/user_store.jsx
index b0ea719d4..d03016c5d 100644
--- a/web/react/stores/user_store.jsx
+++ b/web/react/stores/user_store.jsx
@@ -67,9 +67,18 @@ var UserStore = assign({}, EventEmitter.prototype, {
},
setCurrentId: function(id) {
this._current_id = id;
+ if (id == null) {
+ BrowserStore.removeGlobalItem("current_user_id");
+ } else {
+ BrowserStore.setGlobalItem("current_user_id", id);
+ }
},
getCurrentId: function(skipFetch) {
- var current_id = this._current_id;
+ var current_id = this._current_id;
+
+ if (current_id == null) {
+ current_id = BrowserStore.getGlobalItem("current_user_id");
+ }
// this is a speical case to force fetch the
// current user if it's missing
@@ -92,17 +101,11 @@ var UserStore = assign({}, EventEmitter.prototype, {
return this._getProfiles()[this.getCurrentId()];
},
setCurrentUser: function(user) {
- this.saveProfile(user);
this.setCurrentId(user.id);
- },
- getLastDomain: function() {
- return BrowserStore.getItem("last_domain", '');
- },
- setLastDomain: function(domain) {
- BrowserStore.setItem("last_domain", domain);
+ this.saveProfile(user);
},
getLastEmail: function() {
- return BrowserStore.getItem("last_email", '');
+ return BrowserStore.getItem("last_email", '');
},
setLastEmail: function(email) {
BrowserStore.setItem("last_email", email);
@@ -144,18 +147,18 @@ var UserStore = assign({}, EventEmitter.prototype, {
this._storeProfiles(ps);
},
_storeProfiles: function(profiles) {
- BrowserStore.setGlobalItem("profiles", profiles);
+ BrowserStore.setItem("profiles", profiles);
var profileUsernameMap = {};
for (var id in profiles) {
profileUsernameMap[profiles[id].username] = profiles[id];
}
- BrowserStore.setGlobalItem("profileUsernameMap", profileUsernameMap);
+ BrowserStore.setItem("profileUsernameMap", profileUsernameMap);
},
_getProfiles: function() {
- return BrowserStore.getGlobalItem("profiles", {});
+ return BrowserStore.getItem("profiles", {});
},
_getProfilesUsernameMap: function() {
- return BrowserStore.getGlobalItem("profileUsernameMap", {});
+ return BrowserStore.getItem("profileUsernameMap", {});
},
setSessions: function(sessions) {
BrowserStore.setItem("sessions", sessions);