frontend: update participant name handling
This commit is contained in:
parent
bc58d15a20
commit
ca90a03b9a
@ -136,7 +136,7 @@
|
|||||||
<button
|
<button
|
||||||
mat-icon-button
|
mat-icon-button
|
||||||
(click)="unmakeModerator(participant)"
|
(click)="unmakeModerator(participant)"
|
||||||
matTooltip="Remove participant moderator"
|
matTooltip="Unmake participant moderator"
|
||||||
class="remove-moderator-btn"
|
class="remove-moderator-btn"
|
||||||
>
|
>
|
||||||
<mat-icon class="material-symbols-outlined">remove_moderator</mat-icon>
|
<mat-icon class="material-symbols-outlined">remove_moderator</mat-icon>
|
||||||
@ -242,11 +242,6 @@
|
|||||||
@if (participantForm.get('name')?.hasError('required')) {
|
@if (participantForm.get('name')?.hasError('required')) {
|
||||||
<mat-error> The name is <strong>required</strong> </mat-error>
|
<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>
|
</mat-form-field>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
|
|||||||
@ -261,7 +261,6 @@ export class MeetingComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.participantName = value.name.trim();
|
this.participantName = value.name.trim();
|
||||||
this.participantService.setParticipantName(this.participantName);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await this.generateParticipantToken();
|
await this.generateParticipantToken();
|
||||||
@ -298,6 +297,7 @@ export class MeetingComponent implements OnInit {
|
|||||||
secret: this.roomSecret,
|
secret: this.roomSecret,
|
||||||
participantName: this.participantName
|
participantName: this.participantName
|
||||||
});
|
});
|
||||||
|
this.participantName = this.participantService.getParticipantName()!;
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
console.error('Error generating participant token:', error);
|
console.error('Error generating participant token:', error);
|
||||||
switch (error.status) {
|
switch (error.status) {
|
||||||
@ -309,11 +309,6 @@ export class MeetingComponent implements OnInit {
|
|||||||
// Room not found
|
// Room not found
|
||||||
await this.navigationService.redirectToErrorPage(ErrorReason.INVALID_ROOM, true);
|
await this.navigationService.redirectToErrorPage(ErrorReason.INVALID_ROOM, true);
|
||||||
break;
|
break;
|
||||||
case 409:
|
|
||||||
// Participant already exists.
|
|
||||||
// Show the error message in participant name input form
|
|
||||||
this.participantForm.get('name')?.setErrors({ participantExists: true });
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
await this.navigationService.redirectToErrorPage(ErrorReason.INTERNAL_ERROR, true);
|
await this.navigationService.redirectToErrorPage(ErrorReason.INTERNAL_ERROR, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -78,7 +78,11 @@ export class ParticipantService {
|
|||||||
const decodedToken = getValidDecodedToken(token);
|
const decodedToken = getValidDecodedToken(token);
|
||||||
const metadata = decodedToken.metadata as MeetTokenMetadata;
|
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;
|
this.role = metadata.selectedRole;
|
||||||
const openviduPermissions = metadata.roles.find((r) => r.role === this.role)!.permissions;
|
const openviduPermissions = metadata.roles.find((r) => r.role === this.role)!.permissions;
|
||||||
this.permissions = {
|
this.permissions = {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user