Merge pull request #4314 from FinnStutzenstein/implementMissingUpdateInViewUser

Implement missing update behaviour for users
This commit is contained in:
Emanuel Schütze 2019-02-12 11:58:07 +01:00 committed by GitHub
commit 96a63ecd77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 14 deletions

View File

@ -125,6 +125,7 @@ export class ViewItem extends BaseViewModel {
public updateDependencies(update: BaseViewModel): boolean { public updateDependencies(update: BaseViewModel): boolean {
if ( if (
update &&
update.collectionString === this.item.content_object.collection && update.collectionString === this.item.content_object.collection &&
update.id === this.item.content_object.id update.id === this.item.content_object.id
) { ) {

View File

@ -206,21 +206,13 @@ export class ViewUser extends BaseProjectableViewModel implements Searchable {
return this.full_name; return this.full_name;
}; };
/**
* TODO: Implement
*/
public replaceGroup(newGroup: ViewGroup): void {}
public updateDependencies(update: BaseViewModel): void { public updateDependencies(update: BaseViewModel): void {
if (update instanceof ViewGroup) { if (update instanceof ViewGroup && this.user.groups_id.includes(update.id)) {
this.updateGroup(update); const groupIndex = this.groups.findIndex(group => group.id === update.id);
} if (groupIndex < 0) {
} this.groups.push(update);
} else {
public updateGroup(group: ViewGroup): void { this.groups[groupIndex] = update;
if (this.user && this.user.groups_id) {
if (this.user.containsGroupId(group.id)) {
this.replaceGroup(group);
} }
} }
} }