Merge pull request #4772 from FinnStutzenstein/itemNumberFix

Temporary fix for the agenda item number during updates.
This commit is contained in:
Emanuel Schütze 2019-06-07 15:25:57 +02:00 committed by GitHub
commit 5a5264046e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 1 deletions

View File

@ -139,6 +139,27 @@ export class ItemRepositoryService extends BaseHasContentObjectRepository<
await this.httpService.delete(restUrl); await this.httpService.delete(restUrl);
} }
/**
* TODO: Copied from BaseRepository and added the cloned model to write back the
* item_number correctly. This must be reversed with #4738 (indroduced with #4639)
*
* Saves the (full) update to an existing model. So called "update"-function
* Provides a default procedure, but can be overwritten if required
*
* @param update the update that should be created
* @param viewModel the view model that the update is based on
*/
public async update(update: Partial<Item>, viewModel: ViewItem): Promise<void> {
const sendUpdate = new this.baseModelCtor();
sendUpdate.patchValues(viewModel.getModel());
sendUpdate.patchValues(update);
const clone = JSON.parse(JSON.stringify(sendUpdate));
clone.item_number = clone._itemNumber;
const restPath = `/rest/${sendUpdate.collectionString}/${sendUpdate.id}/`;
return await this.httpService.put(restPath, clone);
}
/** /**
* Get agenda visibility from the config * Get agenda visibility from the config
* *

View File

@ -440,7 +440,7 @@ export class ListOfSpeakersComponent extends BaseViewComponent implements OnInit
if (!this.speakers || !this.speakers.length) { if (!this.speakers || !this.speakers.length) {
this.filteredUsers.next(users); this.filteredUsers.next(users);
} else { } else {
this.filteredUsers.next(users.filter(u => !this.speakers.some(speaker => speaker.user.id === u.id))); this.filteredUsers.next(users.filter(u => !this.speakers.some(speaker => speaker.userId === u.id)));
} }
} }
} }