summaryrefslogtreecommitdiffstats
path: root/web/react/stores/user_store.jsx
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2015-07-08 11:50:10 -0400
committerChristopher Speller <crspeller@gmail.com>2015-07-20 17:45:23 -0400
commitc6fb95912bb481791c1ca370a46a4da9c05d05ad (patch)
treebb33ff7b494b45c9d95c15f290d97914e911ce91 /web/react/stores/user_store.jsx
parenta1876cf6cc827743d8687a9113b727ef7190f452 (diff)
downloadchat-c6fb95912bb481791c1ca370a46a4da9c05d05ad.tar.gz
chat-c6fb95912bb481791c1ca370a46a4da9c05d05ad.tar.bz2
chat-c6fb95912bb481791c1ca370a46a4da9c05d05ad.zip
Changing the way we mattermost handles URLs. team.domain.com becomes domain.com/team.
Renaming team.Name to team.DisplayName and team.Domain to team.Name. So: team.Name -> url safe name. team.DisplayName -> nice name for users
Diffstat (limited to 'web/react/stores/user_store.jsx')
-rw-r--r--web/react/stores/user_store.jsx29
1 files changed, 16 insertions, 13 deletions
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);