Skip to content

Commit

Permalink
Fix participant create wizard presence (#4475)
Browse files Browse the repository at this point in the history
  • Loading branch information
reiterl authored Dec 13, 2024
1 parent 1b77291 commit 2d8ed92
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export class UserRepositoryService extends BaseRepository<ViewUser, User> {
const data = usersToCreate.map(user => {
const meetingUsers = user.meeting_users as Partial<ViewMeetingUser>[];
return {
user: this.sanitizePayload(this.getBaseUserPayload(user), true),
user: this.sanitizePayload(this.getBaseUserPayloadCreate(user), true),
...(meetingUsers && meetingUsers.length
? {
first_meeting_user: this.sanitizePayload(
Expand Down Expand Up @@ -213,7 +213,7 @@ export class UserRepositoryService extends BaseRepository<ViewUser, User> {
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))
}));
});
Expand Down Expand Up @@ -248,7 +248,7 @@ export class UserRepositoryService extends BaseRepository<ViewUser, User> {
return this.createAction(UserAction.ASSIGN_MEETINGS, payload);
}

private getBaseUserPayload(partialUser: Partial<ViewUser>): any {
private getBaseUserPayloadUpdate(partialUser: Partial<ViewUser>): any {
const partialPayload: Partial<User> = {
pronoun: partialUser.pronoun,
title: partialUser.title,
Expand All @@ -269,6 +269,12 @@ export class UserRepositoryService extends BaseRepository<ViewUser, User> {
return partialPayload;
}

private getBaseUserPayloadCreate(partialUser: Partial<ViewUser>): 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);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 2d8ed92

Please sign in to comment.