diff --git a/react/features/filmstrip/middleware.web.js b/react/features/filmstrip/middleware.web.js index 9e8b96c47..fd3324414 100644 --- a/react/features/filmstrip/middleware.web.js +++ b/react/features/filmstrip/middleware.web.js @@ -25,7 +25,6 @@ import { CLEAR_STAGE_PARTICIPANTS, REMOVE_STAGE_PARTICIPANT, RESIZE_FILMSTRIP, - SET_MAX_STAGE_PARTICIPANTS, SET_USER_FILMSTRIP_WIDTH, TOGGLE_PIN_STAGE_PARTICIPANT } from './actionTypes'; @@ -137,6 +136,19 @@ MiddlewareRegistry.register(store => next => action => { } } } + if (action.settings?.maxStageParticipants !== undefined) { + const maxParticipants = action.settings.maxStageParticipants; + const { activeParticipants } = store.getState()['features/filmstrip']; + const newMax = Math.min(MAX_ACTIVE_PARTICIPANTS, maxParticipants); + + if (newMax < activeParticipants.length) { + const toRemove = activeParticipants.slice(0, activeParticipants.length - newMax); + + batch(() => { + toRemove.forEach(p => store.dispatch(removeStageParticipant(p.participantId))); + }); + } + } break; } case SET_USER_FILMSTRIP_WIDTH: { @@ -265,22 +277,6 @@ MiddlewareRegistry.register(store => next => action => { } break; } - case SET_MAX_STAGE_PARTICIPANTS: { - const { maxParticipants } = action; - const { activeParticipants } = store.getState()['features/filmstrip']; - const newMax = Math.min(MAX_ACTIVE_PARTICIPANTS, maxParticipants); - - action.maxParticipants = newMax; - - if (newMax < activeParticipants.length) { - const toRemove = activeParticipants.slice(0, activeParticipants.length - newMax); - - batch(() => { - toRemove.forEach(p => store.dispatch(removeStageParticipant(p.participantId))); - }); - } - break; - } case TOGGLE_PIN_STAGE_PARTICIPANT: { const { dispatch, getState } = store; const state = getState();