diff options
Diffstat (limited to 'webapp/stores')
-rw-r--r-- | webapp/stores/team_store.jsx | 2 | ||||
-rw-r--r-- | webapp/stores/user_store.jsx | 21 |
2 files changed, 19 insertions, 4 deletions
diff --git a/webapp/stores/team_store.jsx b/webapp/stores/team_store.jsx index 3a4ae73b9..8a3457a4d 100644 --- a/webapp/stores/team_store.jsx +++ b/webapp/stores/team_store.jsx @@ -205,7 +205,7 @@ class TeamStoreClass extends EventEmitter { } getMembersInTeam(teamId = this.getCurrentId()) { - return this.members_in_team[teamId] || {}; + return Object.assign({}, this.members_in_team[teamId]) || {}; } hasActiveMemberInTeam(teamId = this.getCurrentId(), userId) { 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) { |