fix(pinning) Fix whiteboard pinning behavior when stage filmstrip is enabled (#12966)

This commit is contained in:
Mihaela Dumitru 2023-02-28 14:44:37 +02:00 committed by GitHub
parent c81777a475
commit 204f34cccb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 0 deletions

View File

@ -19,6 +19,8 @@ import { SETTINGS_UPDATED } from '../base/settings/actionTypes';
import { setTileView } from '../video-layout/actions.web';
import { LAYOUTS } from '../video-layout/constants';
import { getCurrentLayout } from '../video-layout/functions.web';
import { WHITEBOARD_ID } from '../whiteboard/constants';
import { isWhiteboardVisible } from '../whiteboard/functions';
import {
ADD_STAGE_PARTICIPANT,
@ -168,6 +170,7 @@ MiddlewareRegistry.register(store => next => action => {
const state = getState();
const { activeParticipants } = state['features/filmstrip'];
const { maxStageParticipants } = state['features/base/settings'];
const isWhiteboardActive = isWhiteboardVisible(state);
let queue;
if (activeParticipants.find(p => p.participantId === participantId)) {
@ -205,6 +208,14 @@ MiddlewareRegistry.register(store => next => action => {
}
}
if (participantId === WHITEBOARD_ID) {
// If the whiteboard is pinned, this action should clear the other pins.
queue = [ { participantId } ];
} else if (isWhiteboardActive && Array.isArray(queue)) {
// When another participant is pinned, remove the whiteboard from the stage area.
queue = queue.filter(p => p?.participantId !== WHITEBOARD_ID);
}
// If queue is undefined we haven't made any changes to the active participants. This will mostly happen
// if the participant that we are trying to add is not pinned and all slots are currently taken by pinned
// participants.