frontend: update participant name handling

This commit is contained in:
juancarmore 2025-08-22 22:46:07 +02:00
parent bc58d15a20
commit ca90a03b9a
3 changed files with 7 additions and 13 deletions

View File

@ -136,7 +136,7 @@
<button
mat-icon-button
(click)="unmakeModerator(participant)"
matTooltip="Remove participant moderator"
matTooltip="Unmake participant moderator"
class="remove-moderator-btn"
>
<mat-icon class="material-symbols-outlined">remove_moderator</mat-icon>
@ -242,11 +242,6 @@
@if (participantForm.get('name')?.hasError('required')) {
<mat-error> The name is <strong>required</strong> </mat-error>
}
@if (participantForm.get('name')?.hasError('participantExists')) {
<mat-error>
The name is already taken. <strong> Please choose another name </strong>
</mat-error>
}
</mat-form-field>
<button

View File

@ -261,7 +261,6 @@ export class MeetingComponent implements OnInit {
}
this.participantName = value.name.trim();
this.participantService.setParticipantName(this.participantName);
try {
await this.generateParticipantToken();
@ -298,6 +297,7 @@ export class MeetingComponent implements OnInit {
secret: this.roomSecret,
participantName: this.participantName
});
this.participantName = this.participantService.getParticipantName()!;
} catch (error: any) {
console.error('Error generating participant token:', error);
switch (error.status) {
@ -309,11 +309,6 @@ export class MeetingComponent implements OnInit {
// Room not found
await this.navigationService.redirectToErrorPage(ErrorReason.INVALID_ROOM, true);
break;
case 409:
// Participant already exists.
// Show the error message in participant name input form
this.participantForm.get('name')?.setErrors({ participantExists: true });
break;
default:
await this.navigationService.redirectToErrorPage(ErrorReason.INTERNAL_ERROR, true);
}

View File

@ -78,7 +78,11 @@ export class ParticipantService {
const decodedToken = getValidDecodedToken(token);
const metadata = decodedToken.metadata as MeetTokenMetadata;
this.participantIdentity = decodedToken.sub;
if (decodedToken.sub && decodedToken.name) {
this.setParticipantName(decodedToken.name);
this.participantIdentity = decodedToken.sub;
}
this.role = metadata.selectedRole;
const openviduPermissions = metadata.roles.find((r) => r.role === this.role)!.permissions;
this.permissions = {