From 2d8ed9208964bc7246252d24dce62d77d703b780 Mon Sep 17 00:00:00 2001 From: Ludwig Reiter Date: Fri, 13 Dec 2024 10:15:47 +0100 Subject: [PATCH] Fix participant create wizard presence (#4475) --- .../repositories/users/user-repository.service.ts | 12 +++++++++--- .../participant-create-wizard.component.ts | 5 ++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/client/src/app/gateways/repositories/users/user-repository.service.ts b/client/src/app/gateways/repositories/users/user-repository.service.ts index e37a25e73e..8db4e0c488 100644 --- a/client/src/app/gateways/repositories/users/user-repository.service.ts +++ b/client/src/app/gateways/repositories/users/user-repository.service.ts @@ -148,7 +148,7 @@ export class UserRepositoryService extends BaseRepository { const data = usersToCreate.map(user => { const meetingUsers = user.meeting_users as Partial[]; return { - user: this.sanitizePayload(this.getBaseUserPayload(user), true), + user: this.sanitizePayload(this.getBaseUserPayloadCreate(user), true), ...(meetingUsers && meetingUsers.length ? { first_meeting_user: this.sanitizePayload( @@ -213,7 +213,7 @@ export class UserRepositoryService extends BaseRepository { const updates = Array.isArray(dirtyUpdate) ? dirtyUpdate : [dirtyUpdate]; return updates.map(update => ({ id: user.id, - ...this.sanitizePayload(this.getBaseUserPayload(update)), + ...this.sanitizePayload(this.getBaseUserPayloadUpdate(update)), ...this.sanitizePayload(this.meetingUserRepo.getBaseUserPayload(update)) })); }); @@ -248,7 +248,7 @@ export class UserRepositoryService extends BaseRepository { return this.createAction(UserAction.ASSIGN_MEETINGS, payload); } - private getBaseUserPayload(partialUser: Partial): any { + private getBaseUserPayloadUpdate(partialUser: Partial): any { const partialPayload: Partial = { pronoun: partialUser.pronoun, title: partialUser.title, @@ -269,6 +269,12 @@ export class UserRepositoryService extends BaseRepository { return partialPayload; } + private getBaseUserPayloadCreate(partialUser: Partial): any { + const partialPayload = this.getBaseUserPayloadUpdate(partialUser); + partialPayload.is_present_in_meeting_ids = partialUser.is_present_in_meeting_ids; + return partialPayload; + } + public getTitle = (viewUser: ViewUser): string => this.getFullName(viewUser); /** diff --git a/client/src/app/site/pages/meetings/pages/participants/pages/participant-detail/pages/participant-detail-manage/components/participant-create-wizard/participant-create-wizard.component.ts b/client/src/app/site/pages/meetings/pages/participants/pages/participant-detail/pages/participant-detail-manage/components/participant-create-wizard/participant-create-wizard.component.ts index 8d969f8ff2..291412a9d5 100644 --- a/client/src/app/site/pages/meetings/pages/participants/pages/participant-detail/pages/participant-detail-manage/components/participant-create-wizard/participant-create-wizard.component.ts +++ b/client/src/app/site/pages/meetings/pages/participants/pages/participant-detail/pages/participant-detail-manage/components/participant-create-wizard/participant-create-wizard.component.ts @@ -67,7 +67,7 @@ export class ParticipantCreateWizardComponent extends BaseMeetingComponent imple public get patchFormValueFn(): (controlName: string, user?: ViewUser) => any | null { return (controlName, user) => { if (controlName === `is_present`) { - return user?.isPresentInMeeting ? user.isPresentInMeeting() : true; + return user?.isPresentInMeeting ? user.isPresentInMeeting() : false; } return null; }; @@ -286,6 +286,9 @@ export class ParticipantCreateWizardComponent extends BaseMeetingComponent imple id: this._accountId }) .resolve(); + if (this.personalInfoFormValue.is_present) { + this.repo.setPresent(true, { ...payload, id: this._accountId }).resolve(); + } } else { this.repo.create(payload); }