diff options
Diffstat (limited to 'webapp/stores/user_store.jsx')
-rw-r--r-- | webapp/stores/user_store.jsx | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/webapp/stores/user_store.jsx b/webapp/stores/user_store.jsx index d93848670..9ac8540f9 100644 --- a/webapp/stores/user_store.jsx +++ b/webapp/stores/user_store.jsx @@ -169,11 +169,12 @@ class UserStoreClass extends EventEmitter { // System-Wide Profiles saveProfiles(profiles) { + const newProfiles = Object.assign({}, profiles); const currentId = this.getCurrentId(); - if (profiles[currentId]) { - Reflect.deleteProperty(profiles, currentId); + if (newProfiles[currentId]) { + Reflect.deleteProperty(newProfiles, currentId); } - this.profiles = Object.assign({}, this.profiles, profiles); + this.profiles = Object.assign({}, this.profiles, newProfiles); } getProfiles() { @@ -331,6 +332,20 @@ class UserStoreClass extends EventEmitter { return profiles; } + removeProfileFromTeam(teamId, userId) { + const userIds = this.profiles_in_team[teamId]; + if (!userIds) { + return; + } + + const index = userIds.indexOf(userId); + if (index === -1) { + return; + } + + userIds.splice(index, 1); + } + // Channel-Wide Profiles saveProfilesInChannel(channelId = ChannelStore.getCurrentId(), profiles) { |