Skip to content

Commit

Permalink
fix(external-api) Unpin all participants when participant id is null (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
horymury authored Feb 16, 2023
1 parent 123a74b commit 8cd62bc
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions modules/API/API.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,13 @@ import {
import { appendSuffix } from '../../react/features/display-name';
import { isEnabled as isDropboxEnabled } from '../../react/features/dropbox';
import { setMediaEncryptionKey, toggleE2EE } from '../../react/features/e2ee/actions';
import { addStageParticipant, resizeFilmStrip, setVolume } from '../../react/features/filmstrip/actions.web';
import { isStageFilmstripAvailable } from '../../react/features/filmstrip/functions.web';
import {
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 {
selectParticipantInLargeVideo
Expand Down Expand Up @@ -241,6 +246,22 @@ function initCommands() {
logger.debug('Pin participant command received');

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
? getVirtualScreenshareParticipantByOwnerId(state, id) : getParticipantById(state, id);

Expand All @@ -254,7 +275,7 @@ function initCommands() {

const participantId = participant.id;

if (isStageFilmstripAvailable(APP.store.getState())) {
if (isStageFilmstripAvailable(state)) {
APP.store.dispatch(addStageParticipant(participantId, true));
} else {
APP.store.dispatch(pinParticipant(participantId));
Expand Down

0 comments on commit 8cd62bc

Please sign in to comment.