From f1fc2e0ba43e4fbe3bd4e77c8ebea22da0d1cb00 Mon Sep 17 00:00:00 2001
From: Carlos Santos <4a.santos@gmail.com>
Date: Tue, 19 Aug 2025 16:08:15 +0200
Subject: [PATCH] frontend: enhance participant role management with original
role tracking
---
.../lib/models/custom-participant.model.ts | 19 +++-
.../lib/pages/meeting/meeting.component.html | 102 +++++++++++-------
.../lib/pages/meeting/meeting.component.ts | 23 ++++
3 files changed, 105 insertions(+), 39 deletions(-)
diff --git a/frontend/projects/shared-meet-components/src/lib/models/custom-participant.model.ts b/frontend/projects/shared-meet-components/src/lib/models/custom-participant.model.ts
index 4d7e49f..4ca5f32 100644
--- a/frontend/projects/shared-meet-components/src/lib/models/custom-participant.model.ts
+++ b/frontend/projects/shared-meet-components/src/lib/models/custom-participant.model.ts
@@ -3,22 +3,37 @@ import { ParticipantModel, ParticipantProperties } from 'openvidu-components-ang
// Represents a participant in the application.
export class CustomParticipantModel extends ParticipantModel {
- // Indicates the role of the participant.
+ // Indicates the original role of the participant.
+ private _meetOriginalRole: ParticipantRole;
+ // Indicates the current role of the participant.
private _meetRole: ParticipantRole;
constructor(props: ParticipantProperties) {
super(props);
const participant = props.participant;
- this._meetRole = extractParticipantRole(participant.metadata);
+ this._meetOriginalRole = extractParticipantRole(participant.metadata);
+ this._meetRole = this._meetOriginalRole;
}
set meetRole(role: ParticipantRole) {
this._meetRole = role;
}
+ /**
+ * Checks if the current role of the participant is moderator.
+ * @returns True if the current role is moderator, false otherwise.
+ */
isModerator(): boolean {
return this._meetRole === ParticipantRole.MODERATOR;
}
+
+ /**
+ * Checks if the original role of the participant is moderator.
+ * @returns True if the original role is moderator, false otherwise.
+ */
+ isOriginalModerator(): boolean {
+ return this._meetOriginalRole === ParticipantRole.MODERATOR;
+ }
}
const extractParticipantRole = (metadata: any): ParticipantRole => {
diff --git a/frontend/projects/shared-meet-components/src/lib/pages/meeting/meeting.component.html b/frontend/projects/shared-meet-components/src/lib/pages/meeting/meeting.component.html
index b34395a..d893f01 100644
--- a/frontend/projects/shared-meet-components/src/lib/pages/meeting/meeting.component.html
+++ b/frontend/projects/shared-meet-components/src/lib/pages/meeting/meeting.component.html
@@ -1,7 +1,6 @@
@if (showMeeting) {