feat(external-api) expose breakout rooms actions

This commit is contained in:
Mihaela Dumitru
2022-02-04 12:51:33 +02:00
committed by GitHub
parent 66b4c0cab0
commit 01ab415941
2 changed files with 74 additions and 0 deletions

View File

@@ -43,6 +43,15 @@ import {
} from '../../react/features/base/participants';
import { updateSettings } from '../../react/features/base/settings';
import { isToggleCameraEnabled, toggleCamera } from '../../react/features/base/tracks';
import {
autoAssignToBreakoutRooms,
closeBreakoutRoom,
createBreakoutRoom,
moveToRoom,
removeBreakoutRoom,
sendParticipantToRoom
} from '../../react/features/breakout-rooms/actions';
import { getBreakoutRooms } from '../../react/features/breakout-rooms/functions';
import {
sendMessage,
setPrivateMessageRecipient,
@@ -118,6 +127,14 @@ let videoAvailable = true;
*/
function initCommands() {
commands = {
'add-breakout-room': name => {
if (!isLocalParticipantModerator(APP.store.getState())) {
logger.error('Missing moderator rights to add breakout rooms');
return;
}
APP.store.dispatch(createBreakoutRoom(name));
},
'answer-knocking-participant': (id, approved) => {
APP.store.dispatch(setKnockingParticipantApproval(id, approved));
},
@@ -135,6 +152,14 @@ function initCommands() {
APP.store.dispatch(approveParticipantAudio(participantId));
},
'auto-assign-to-breakout-rooms': () => {
if (!isLocalParticipantModerator(APP.store.getState())) {
logger.error('Missing moderator rights to auto-assign participants to breakout rooms');
return;
}
APP.store.dispatch(autoAssignToBreakoutRooms());
},
'display-name': displayName => {
sendAnalytics(createApiEvent('display.name.changed'));
APP.conference.changeLocalDisplayName(displayName);
@@ -198,6 +223,14 @@ function initCommands() {
APP.store.dispatch(reject(participantId));
},
'remove-breakout-room': breakoutRoomJid => {
if (!isLocalParticipantModerator(APP.store.getState())) {
logger.error('Missing moderator rights to remove breakout rooms');
return;
}
APP.store.dispatch(removeBreakoutRoom(breakoutRoomJid));
},
'resize-large-video': (width, height) => {
logger.debug('Resize large video command received');
sendAnalytics(createApiEvent('largevideo.resized'));
@@ -537,6 +570,26 @@ function initCommands() {
'cancel-private-chat': () => {
APP.store.dispatch(setPrivateMessageRecipient());
},
'close-breakout-room': roomId => {
if (!isLocalParticipantModerator(APP.store.getState())) {
logger.error('Missing moderator rights to close breakout rooms');
return;
}
APP.store.dispatch(closeBreakoutRoom(roomId));
},
'join-breakout-room': roomId => {
APP.store.dispatch(moveToRoom(roomId));
},
'send-participant-to-room': (participantId, roomId) => {
if (!isLocalParticipantModerator(APP.store.getState())) {
logger.error('Missing moderator rights to send participants to rooms');
return;
}
APP.store.dispatch(sendParticipantToRoom(participantId, roomId));
},
'kick-participant': participantId => {
APP.store.dispatch(kickParticipant(participantId));
},
@@ -681,6 +734,10 @@ function initCommands() {
});
break;
}
case 'list-breakout-rooms': {
callback(getBreakoutRooms(APP.store.getState()));
break;
}
default:
return false;
}