Add "close meeting" function for moderator
parent
d756dd4721
commit
04b2d6d443
|
|
@ -1178,6 +1178,26 @@ export default class RoomClient
|
|||
roomActions.setStopAllVideoInProgress(false));
|
||||
}
|
||||
|
||||
async closeMeeting()
|
||||
{
|
||||
logger.debug('closeMeeting()');
|
||||
|
||||
store.dispatch(
|
||||
roomActions.setCloseMeetingInProgress(true));
|
||||
|
||||
try
|
||||
{
|
||||
await this.sendRequest('moderator:closeMeeting');
|
||||
}
|
||||
catch (error)
|
||||
{
|
||||
logger.error('closeMeeting() failed: %o', error);
|
||||
}
|
||||
|
||||
store.dispatch(
|
||||
roomActions.setCloseMeetingInProgress(false));
|
||||
}
|
||||
|
||||
// type: mic/webcam/screen
|
||||
// mute: true/false
|
||||
async modifyPeerConsumer(peerId, type, mute)
|
||||
|
|
|
|||
|
|
@ -121,4 +121,10 @@ export const setStopAllVideoInProgress = (flag) =>
|
|||
({
|
||||
type : 'STOP_ALL_VIDEO_IN_PROGRESS',
|
||||
payload : { flag }
|
||||
});
|
||||
|
||||
export const setCloseMeetingInProgress = (flag) =>
|
||||
({
|
||||
type : 'CLOSE_MEETING_IN_PROGRESS',
|
||||
payload : { flag }
|
||||
});
|
||||
|
|
@ -71,6 +71,23 @@ const ListModerator = (props) =>
|
|||
defaultMessage='Stop all video'
|
||||
/>
|
||||
</Button>
|
||||
<div className={classes.divider} />
|
||||
<Button
|
||||
aria-label={intl.formatMessage({
|
||||
id : 'room.closeMeeting',
|
||||
defaultMessage : 'Close meeting'
|
||||
})}
|
||||
className={classes.actionButton}
|
||||
variant='contained'
|
||||
color='secondary'
|
||||
disabled={room.closeMeetingInProgress}
|
||||
onClick={() => roomClient.closeMeeting()}
|
||||
>
|
||||
<FormattedMessage
|
||||
id='room.closeMeeting'
|
||||
defaultMessage='Close meeting'
|
||||
/>
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,24 +1,27 @@
|
|||
const initialState =
|
||||
{
|
||||
name : '',
|
||||
state : 'new', // new/connecting/connected/disconnected/closed,
|
||||
locked : false,
|
||||
inLobby : false,
|
||||
signInRequired : false,
|
||||
accessCode : '', // access code to the room if locked and joinByAccessCode == true
|
||||
joinByAccessCode : true, // if true: accessCode is a possibility to open the room
|
||||
activeSpeakerId : null,
|
||||
torrentSupport : false,
|
||||
showSettings : false,
|
||||
fullScreenConsumer : null, // ConsumerID
|
||||
windowConsumer : null, // ConsumerID
|
||||
toolbarsVisible : true,
|
||||
mode : 'democratic',
|
||||
selectedPeerId : null,
|
||||
spotlights : [],
|
||||
settingsOpen : false,
|
||||
lockDialogOpen : false,
|
||||
joined : false
|
||||
name : '',
|
||||
state : 'new', // new/connecting/connected/disconnected/closed,
|
||||
locked : false,
|
||||
inLobby : false,
|
||||
signInRequired : false,
|
||||
accessCode : '', // access code to the room if locked and joinByAccessCode == true
|
||||
joinByAccessCode : true, // if true: accessCode is a possibility to open the room
|
||||
activeSpeakerId : null,
|
||||
torrentSupport : false,
|
||||
showSettings : false,
|
||||
fullScreenConsumer : null, // ConsumerID
|
||||
windowConsumer : null, // ConsumerID
|
||||
toolbarsVisible : true,
|
||||
mode : 'democratic',
|
||||
selectedPeerId : null,
|
||||
spotlights : [],
|
||||
settingsOpen : false,
|
||||
lockDialogOpen : false,
|
||||
joined : false,
|
||||
muteAllInProgress : false,
|
||||
stopAllVideoInProgress : false,
|
||||
closeMeetingInProgress : false
|
||||
};
|
||||
|
||||
const room = (state = initialState, action) =>
|
||||
|
|
@ -169,6 +172,9 @@ const room = (state = initialState, action) =>
|
|||
case 'STOP_ALL_VIDEO_IN_PROGRESS':
|
||||
return { ...state, stopAllVideoInProgress: action.payload.flag };
|
||||
|
||||
case 'CLOSE_MEETING_IN_PROGRESS':
|
||||
return { ...state, closeMeetingInProgress: action.payload.flag };
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1105,6 +1105,33 @@ class Room extends EventEmitter
|
|||
break;
|
||||
}
|
||||
|
||||
case 'moderator:closeMeeting':
|
||||
{
|
||||
if (
|
||||
!peer.hasRole(userRoles.MODERATOR) &&
|
||||
!peer.hasRole(userRoles.ADMIN)
|
||||
)
|
||||
throw new Error('peer does not have moderator priveleges');
|
||||
|
||||
this._notification(
|
||||
peer.socket,
|
||||
'moderator:kick',
|
||||
null,
|
||||
true
|
||||
);
|
||||
|
||||
// Close the peers.
|
||||
for (const kickedPeer in this._peers)
|
||||
{
|
||||
if (peer !== kickedPeer)
|
||||
kickedPeer.close();
|
||||
}
|
||||
|
||||
cb();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 'moderator:kickPeer':
|
||||
{
|
||||
if (
|
||||
|
|
|
|||
Loading…
Reference in New Issue