ov-components: rename redirectOnLeaves to redirectToHomeOnLeaves for clarity and update related logic

master
Carlos Santos 2025-05-23 11:09:07 +02:00
parent b6f242107e
commit 549a822491
2 changed files with 16 additions and 11 deletions

View File

@ -599,7 +599,7 @@ describe('Testing videoconference EVENTS', () => {
expect(await utils.isPresent('#onReadyToJoin')).toBeFalse(); expect(await utils.isPresent('#onReadyToJoin')).toBeFalse();
}); });
// * PUBLISHER EVENTS // PARTICIPANT EVENTS
it('should receive onParticipantCreated event from LOCAL participant', async () => { it('should receive onParticipantCreated event from LOCAL participant', async () => {
const participantName = 'TEST_USER'; const participantName = 'TEST_USER';
@ -609,7 +609,7 @@ describe('Testing videoconference EVENTS', () => {
}); });
it('should receive the onParticipantLeft event', async () => { 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(); await utils.checkSessionIsPresent();

View File

@ -60,7 +60,7 @@ export class CallComponent implements OnInit {
activitiesPanelBroadcastingActivity: boolean = true; activitiesPanelBroadcastingActivity: boolean = true;
toolbarSettingsButton: boolean = true; toolbarSettingsButton: boolean = true;
fakeDevices: boolean = false; fakeDevices: boolean = false;
private redirectOnLeaves: boolean = true; private redirectToHomeOnLeaves: boolean = true;
private staticVideos = [ private staticVideos = [
'https://videos.pexels.com/video-files/4089575/4089575-hd_1280_720_50fps.mp4', '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['fakeDevices'] !== undefined) this.fakeDevices = params['fakeDevices'] === 'true';
if (params['redirect'] === undefined) { if (params['redirectToHome'] === undefined) {
this.redirectOnLeaves = true; this.redirectToHomeOnLeaves = true;
} else { } else {
this.redirectOnLeaves = params['redirect'] === 'true'; this.redirectToHomeOnLeaves = params['redirectToHome'] === 'true';
} }
this.configReady = true; this.configReady = true;
@ -177,7 +177,7 @@ export class CallComponent implements OnInit {
async onParticipantLeft(event: ParticipantLeftEvent) { async onParticipantLeft(event: ParticipantLeftEvent) {
this.appendElement('onParticipantLeft'); this.appendElement('onParticipantLeft');
console.warn('VC PARTICIPANT LEFT', event); console.warn('VC PARTICIPANT LEFT', event);
if (this.redirectOnLeaves) await this.router.navigate(['/']); if (this.redirectToHomeOnLeaves) await this.router.navigate(['/']);
} }
onRoomCreated(room: Room) { onRoomCreated(room: Room) {
@ -363,11 +363,16 @@ export class CallComponent implements OnInit {
} }
private appendElement(id: string) { private appendElement(id: string) {
var eventsDiv = document.getElementById('events'); const eventsDiv = document.getElementById('events');
eventsDiv?.setAttribute('style', 'position: absolute;'); if (!eventsDiv) {
var element = document.createElement('div'); console.error('No events div found');
return;
}
eventsDiv.setAttribute('style', 'position: absolute;');
const element = document.createElement('div');
element.setAttribute('id', id); element.setAttribute('id', id);
element.setAttribute('style', 'height: 1px;'); element.setAttribute('style', 'height: 1px;');
eventsDiv?.appendChild(element); eventsDiv.appendChild(element);
} }
} }