diff --git a/react/features/lobby/functions.js b/react/features/lobby/functions.js index 0a4a01ce1..23d6d9c3c 100644 --- a/react/features/lobby/functions.js +++ b/react/features/lobby/functions.js @@ -1,28 +1,5 @@ // @flow -import { getCurrentConference } from '../base/conference'; - -/** - * Approves (lets in) or rejects a knocking participant. - * - * @param {Function} getState - Function to get the Redux state. - * @param {string} id - The id of the knocking participant. - * @param {boolean} approved - True if the participant is approved, false otherwise. - * @returns {Function} - */ -export function setKnockingParticipantApproval(getState: Function, id: string, approved: boolean) { - const conference = getCurrentConference(getState()); - - if (conference) { - if (approved) { - conference.lobbyApproveAccess(id); - } else { - conference.lobbyDenyAccess(id); - } - } -} - - /** * Selector to return lobby state. * diff --git a/react/features/participants-pane/components/native/ContextMenuMore.js b/react/features/participants-pane/components/native/ContextMenuMore.js index 03a9bbc61..73e522997 100644 --- a/react/features/participants-pane/components/native/ContextMenuMore.js +++ b/react/features/participants-pane/components/native/ContextMenuMore.js @@ -14,8 +14,7 @@ import { } from '../../../base/icons'; import { MEDIA_TYPE } from '../../../base/media'; import { - muteAllParticipants, - unmuteDisabled + muteAllParticipants } from '../../../video-menu/actions.any'; import styles from './styles'; @@ -35,7 +34,6 @@ type Props = { export const ContextMenuMore = ({ exclude }: Props) => { const dispatch = useDispatch(); const cancel = useCallback(() => dispatch(hideDialog()), [ dispatch ]); - const unMuteDisabled = useCallback(() => dispatch(unmuteDisabled()), [ dispatch ]); const muteEveryoneVideo = useCallback(() => dispatch(muteAllParticipants(exclude, MEDIA_TYPE.VIDEO)), [ dispatch ]); const { t } = useTranslation(); @@ -52,7 +50,6 @@ export const ContextMenuMore = ({ exclude }: Props) => { {t('participantsPane.actions.stopEveryonesVideo')} { + const dispatch = useDispatch(); + const admitAll = useCallback(() => dispatch(admitAllKnockingParticipants()), [ dispatch ]); const { t } = useTranslation(); return ( @@ -21,7 +26,8 @@ export const LobbyParticipantList = () => { diff --git a/react/features/video-menu/actions.any.js b/react/features/video-menu/actions.any.js index 74ea078ce..c89103243 100644 --- a/react/features/video-menu/actions.any.js +++ b/react/features/video-menu/actions.any.js @@ -23,6 +23,8 @@ import { getRemoteParticipants, muteRemoteParticipant } from '../base/participants'; +import { setKnockingParticipantApproval } from '../lobby/actions'; +import { getLobbyState } from '../lobby/functions'; declare var APP: Object; @@ -106,3 +108,20 @@ export function muteAllParticipants(exclude: Array, mediaType: MEDIA_TYP }); }; } + +/** + * Admit all knocking participants. + * + * @returns {Function} + */ +export function admitAllKnockingParticipants() { + return (dispatch: Dispatch, getState: Function) => { + const state = getState(); + const { knockingParticipants, lobbyEnabled } = getLobbyState(state); + const knockingParticipantsIds = knockingParticipants.map(participant => participant.id); + + knockingParticipantsIds + .map(id => lobbyEnabled && setKnockingParticipantApproval(id, true)) + .map(dispatch); + }; +}