Fixes for the team user lists in the system console (#4294)

Этот коммит содержится в:
Joram Wilander
2016-10-24 08:50:12 -04:00
коммит произвёл GitHub
родитель 486d12e1c3
Коммит e6d26bee51
7 изменённых файлов: 52 добавлений и 31 удалений

Просмотреть файл

@@ -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) {

Просмотреть файл

@@ -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) {