From 549a82249161e5516d603943440e06345aa6f43b Mon Sep 17 00:00:00 2001 From: Carlos Santos <4a.santos@gmail.com> Date: Fri, 23 May 2025 11:09:07 +0200 Subject: [PATCH] ov-components: rename redirectOnLeaves to redirectToHomeOnLeaves for clarity and update related logic --- .../e2e/events.test.ts | 4 ++-- .../src/app/openvidu-call/call.component.ts | 23 +++++++++++-------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/openvidu-components-angular/e2e/events.test.ts b/openvidu-components-angular/e2e/events.test.ts index 8e16a300..c6e261a9 100644 --- a/openvidu-components-angular/e2e/events.test.ts +++ b/openvidu-components-angular/e2e/events.test.ts @@ -599,7 +599,7 @@ describe('Testing videoconference EVENTS', () => { expect(await utils.isPresent('#onReadyToJoin')).toBeFalse(); }); - // * PUBLISHER EVENTS + // PARTICIPANT EVENTS it('should receive onParticipantCreated event from LOCAL participant', async () => { const participantName = 'TEST_USER'; @@ -609,7 +609,7 @@ describe('Testing videoconference EVENTS', () => { }); it('should receive the onParticipantLeft event', async () => { - await browser.get(`${url}&prejoin=false&redirect=false`); + await browser.get(`${url}&prejoin=false&redirectToHome=false`); await utils.checkSessionIsPresent(); diff --git a/openvidu-components-angular/src/app/openvidu-call/call.component.ts b/openvidu-components-angular/src/app/openvidu-call/call.component.ts index 6fe65c3b..d181d3d9 100644 --- a/openvidu-components-angular/src/app/openvidu-call/call.component.ts +++ b/openvidu-components-angular/src/app/openvidu-call/call.component.ts @@ -60,7 +60,7 @@ export class CallComponent implements OnInit { activitiesPanelBroadcastingActivity: boolean = true; toolbarSettingsButton: boolean = true; fakeDevices: boolean = false; - private redirectOnLeaves: boolean = true; + private redirectToHomeOnLeaves: boolean = true; private staticVideos = [ 'https://videos.pexels.com/video-files/4089575/4089575-hd_1280_720_50fps.mp4', @@ -142,10 +142,10 @@ export class CallComponent implements OnInit { if (params['fakeDevices'] !== undefined) this.fakeDevices = params['fakeDevices'] === 'true'; - if (params['redirect'] === undefined) { - this.redirectOnLeaves = true; + if (params['redirectToHome'] === undefined) { + this.redirectToHomeOnLeaves = true; } else { - this.redirectOnLeaves = params['redirect'] === 'true'; + this.redirectToHomeOnLeaves = params['redirectToHome'] === 'true'; } this.configReady = true; @@ -177,7 +177,7 @@ export class CallComponent implements OnInit { async onParticipantLeft(event: ParticipantLeftEvent) { this.appendElement('onParticipantLeft'); console.warn('VC PARTICIPANT LEFT', event); - if (this.redirectOnLeaves) await this.router.navigate(['/']); + if (this.redirectToHomeOnLeaves) await this.router.navigate(['/']); } onRoomCreated(room: Room) { @@ -363,11 +363,16 @@ export class CallComponent implements OnInit { } private appendElement(id: string) { - var eventsDiv = document.getElementById('events'); - eventsDiv?.setAttribute('style', 'position: absolute;'); - var element = document.createElement('div'); + const eventsDiv = document.getElementById('events'); + if (!eventsDiv) { + console.error('No events div found'); + return; + } + + eventsDiv.setAttribute('style', 'position: absolute;'); + const element = document.createElement('div'); element.setAttribute('id', id); element.setAttribute('style', 'height: 1px;'); - eventsDiv?.appendChild(element); + eventsDiv.appendChild(element); } }