Skip to content

Commit

Permalink
feat(external-api) Add grantModerator command
Browse files Browse the repository at this point in the history
  • Loading branch information
robertpin committed Mar 23, 2022
1 parent 35d0fef commit e4f212f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
11 changes: 10 additions & 1 deletion modules/API/API.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ import {
raiseHand,
isParticipantModerator,
isLocalParticipantModerator,
hasRaisedHand
hasRaisedHand,
grantModerator
} from '../../react/features/base/participants';
import { updateSettings } from '../../react/features/base/settings';
import { isToggleCameraEnabled, toggleCamera } from '../../react/features/base/tracks';
Expand Down Expand Up @@ -164,6 +165,14 @@ function initCommands() {
}
APP.store.dispatch(autoAssignToBreakoutRooms());
},
'grant-moderator': participantId => {
if (!isLocalParticipantModerator(APP.store.getState())) {
logger.error('Missing moderator rights to grant moderator right to another participant');

return;
}
APP.store.dispatch(grantModerator(participantId));
},
'display-name': displayName => {
sendAnalytics(createApiEvent('display.name.changed'));
APP.conference.changeLocalDisplayName(displayName);
Expand Down
3 changes: 2 additions & 1 deletion modules/API/external/external_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const commands = {
displayName: 'display-name',
e2eeKey: 'e2ee-key',
email: 'email',
toggleLobby: 'toggle-lobby',
grantModerator: 'grant-moderator',
hangup: 'video-hangup',
initiatePrivateChat: 'initiate-private-chat',
joinBreakoutRoom: 'join-breakout-room',
Expand Down Expand Up @@ -73,6 +73,7 @@ const commands = {
toggleChat: 'toggle-chat',
toggleE2EE: 'toggle-e2ee',
toggleFilmStrip: 'toggle-film-strip',
toggleLobby: 'toggle-lobby',
toggleModeration: 'toggle-moderation',
toggleParticipantsPane: 'toggle-participants-pane',
toggleRaiseHand: 'toggle-raise-hand',
Expand Down

0 comments on commit e4f212f

Please sign in to comment.