From 91c328b58f50e8d7123a99e634b49082bb75dc5c Mon Sep 17 00:00:00 2001 From: csantosm <4a.santos@gmail.com> Date: Thu, 9 Jun 2022 14:45:59 +0200 Subject: [PATCH] openvidu-components: Fixed recording button toolbar Checked role when the toolbar menu is opened for avoiding deprecated values --- .../src/lib/components/toolbar/toolbar.component.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/openvidu-components-angular/projects/openvidu-angular/src/lib/components/toolbar/toolbar.component.ts b/openvidu-components-angular/projects/openvidu-angular/src/lib/components/toolbar/toolbar.component.ts index cf321f5a..7dcd9d6d 100644 --- a/openvidu-components-angular/projects/openvidu-angular/src/lib/components/toolbar/toolbar.component.ts +++ b/openvidu-components-angular/projects/openvidu-angular/src/lib/components/toolbar/toolbar.component.ts @@ -1,4 +1,5 @@ import { + AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, @@ -100,7 +101,7 @@ import { TranslateService } from '../../services/translate/translate.service'; styleUrls: ['./toolbar.component.css'], changeDetection: ChangeDetectionStrategy.OnPush }) -export class ToolbarComponent implements OnInit, OnDestroy { +export class ToolbarComponent implements OnInit, OnDestroy, AfterViewInit { /** * @ignore */ @@ -399,6 +400,13 @@ export class ToolbarComponent implements OnInit, OnDestroy { this.subscribeToRecordingStatus(); } + ngAfterViewInit() { + // Sometimes the connection is undefined so we have to check the role when the mat menu is opened + this.menuTrigger?.menuOpened.subscribe(() => { + this.isSessionCreator = this.participantService.getMyRole() === OpenViduRole.MODERATOR; + }); + } + ngOnDestroy(): void { if (this.panelTogglingSubscription) this.panelTogglingSubscription.unsubscribe(); if (this.chatMessagesSubscription) this.chatMessagesSubscription.unsubscribe();