summaryrefslogtreecommitdiffstats
path: root/webapp/stores/user_store.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/stores/user_store.jsx')
-rw-r--r--webapp/stores/user_store.jsx33
1 files changed, 32 insertions, 1 deletions
diff --git a/webapp/stores/user_store.jsx b/webapp/stores/user_store.jsx
index 4213e6e8c..2c6bfade3 100644
--- a/webapp/stores/user_store.jsx
+++ b/webapp/stores/user_store.jsx
@@ -16,11 +16,17 @@ const CHANGE_EVENT_STATUSES = 'change_statuses';
class UserStoreClass extends EventEmitter {
constructor() {
super();
+ this.clear();
+ }
+
+ clear() {
this.profiles = {};
+ this.direct_profiles = {};
this.statuses = {};
this.sessions = {};
this.audits = {};
this.currentUserId = '';
+ this.noAccounts = false;
}
emitChange(userId) {
@@ -116,7 +122,12 @@ class UserStoreClass extends EventEmitter {
return this.getCurrentUser();
}
- return this.getProfiles()[userId];
+ const user = this.getProfiles()[userId];
+ if (user) {
+ return user;
+ }
+
+ return this.getDirectProfiles()[userId];
}
getProfileByUsername(username) {
@@ -137,6 +148,14 @@ class UserStoreClass extends EventEmitter {
return profileUsernameMap;
}
+ getDirectProfiles() {
+ return this.direct_profiles;
+ }
+
+ saveDirectProfiles(profiles) {
+ this.direct_profiles = profiles;
+ }
+
getProfiles() {
return this.profiles;
}
@@ -259,6 +278,14 @@ class UserStoreClass extends EventEmitter {
getStatus(id) {
return this.getStatuses()[id];
}
+
+ getNoAccounts() {
+ return this.noAccounts;
+ }
+
+ setNoAccounts(noAccounts) {
+ this.noAccounts = noAccounts;
+ }
}
var UserStore = new UserStoreClass();
@@ -272,6 +299,10 @@ UserStore.dispatchToken = AppDispatcher.register((payload) => {
UserStore.saveProfiles(action.profiles);
UserStore.emitChange();
break;
+ case ActionTypes.RECEIVED_DIRECT_PROFILES:
+ UserStore.saveDirectProfiles(action.profiles);
+ UserStore.emitChange();
+ break;
case ActionTypes.RECEIVED_ME:
UserStore.setCurrentUser(action.me);
UserStore.emitChange(action.me.id);