fix(external-api) Unpin all participants when participant id is null (#12921)

This commit is contained in:
Horatiu Muresan 2023-02-16 18:14:10 +02:00 committed by GitHub
parent 123a74b38b
commit 8cd62bc132
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 3 deletions

View File

@ -71,8 +71,13 @@ import {
import { appendSuffix } from '../../react/features/display-name'; import { appendSuffix } from '../../react/features/display-name';
import { isEnabled as isDropboxEnabled } from '../../react/features/dropbox'; import { isEnabled as isDropboxEnabled } from '../../react/features/dropbox';
import { setMediaEncryptionKey, toggleE2EE } from '../../react/features/e2ee/actions'; import { setMediaEncryptionKey, toggleE2EE } from '../../react/features/e2ee/actions';
import { addStageParticipant, resizeFilmStrip, setVolume } from '../../react/features/filmstrip/actions.web'; import {
import { isStageFilmstripAvailable } from '../../react/features/filmstrip/functions.web'; addStageParticipant,
resizeFilmStrip,
setVolume,
togglePinStageParticipant
} from '../../react/features/filmstrip/actions.web';
import { getPinnedActiveParticipants, isStageFilmstripAvailable } from '../../react/features/filmstrip/functions.web';
import { invite } from '../../react/features/invite'; import { invite } from '../../react/features/invite';
import { import {
selectParticipantInLargeVideo selectParticipantInLargeVideo
@ -241,6 +246,22 @@ function initCommands() {
logger.debug('Pin participant command received'); logger.debug('Pin participant command received');
const state = APP.store.getState(); const state = APP.store.getState();
// if id not provided, unpin everybody.
if (!id) {
if (isStageFilmstripAvailable(state)) {
const pinnedParticipants = getPinnedActiveParticipants(state);
pinnedParticipants?.forEach(p => {
APP.store.dispatch(togglePinStageParticipant(p.participantId));
});
} else {
APP.store.dispatch(pinParticipant());
}
return;
}
const participant = videoType === VIDEO_TYPE.DESKTOP const participant = videoType === VIDEO_TYPE.DESKTOP
? getVirtualScreenshareParticipantByOwnerId(state, id) : getParticipantById(state, id); ? getVirtualScreenshareParticipantByOwnerId(state, id) : getParticipantById(state, id);
@ -254,7 +275,7 @@ function initCommands() {
const participantId = participant.id; const participantId = participant.id;
if (isStageFilmstripAvailable(APP.store.getState())) { if (isStageFilmstripAvailable(state)) {
APP.store.dispatch(addStageParticipant(participantId, true)); APP.store.dispatch(addStageParticipant(participantId, true));
} else { } else {
APP.store.dispatch(pinParticipant(participantId)); APP.store.dispatch(pinParticipant(participantId));