Add "close meeting" function for moderator
parent
d756dd4721
commit
04b2d6d443
|
|
@ -1178,6 +1178,26 @@ export default class RoomClient
|
||||||
roomActions.setStopAllVideoInProgress(false));
|
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
|
// type: mic/webcam/screen
|
||||||
// mute: true/false
|
// mute: true/false
|
||||||
async modifyPeerConsumer(peerId, type, mute)
|
async modifyPeerConsumer(peerId, type, mute)
|
||||||
|
|
|
||||||
|
|
@ -122,3 +122,9 @@ export const setStopAllVideoInProgress = (flag) =>
|
||||||
type : 'STOP_ALL_VIDEO_IN_PROGRESS',
|
type : 'STOP_ALL_VIDEO_IN_PROGRESS',
|
||||||
payload : { flag }
|
payload : { flag }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const setCloseMeetingInProgress = (flag) =>
|
||||||
|
({
|
||||||
|
type : 'CLOSE_MEETING_IN_PROGRESS',
|
||||||
|
payload : { flag }
|
||||||
|
});
|
||||||
|
|
@ -71,6 +71,23 @@ const ListModerator = (props) =>
|
||||||
defaultMessage='Stop all video'
|
defaultMessage='Stop all video'
|
||||||
/>
|
/>
|
||||||
</Button>
|
</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>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,10 @@ const initialState =
|
||||||
spotlights : [],
|
spotlights : [],
|
||||||
settingsOpen : false,
|
settingsOpen : false,
|
||||||
lockDialogOpen : false,
|
lockDialogOpen : false,
|
||||||
joined : false
|
joined : false,
|
||||||
|
muteAllInProgress : false,
|
||||||
|
stopAllVideoInProgress : false,
|
||||||
|
closeMeetingInProgress : false
|
||||||
};
|
};
|
||||||
|
|
||||||
const room = (state = initialState, action) =>
|
const room = (state = initialState, action) =>
|
||||||
|
|
@ -169,6 +172,9 @@ const room = (state = initialState, action) =>
|
||||||
case 'STOP_ALL_VIDEO_IN_PROGRESS':
|
case 'STOP_ALL_VIDEO_IN_PROGRESS':
|
||||||
return { ...state, stopAllVideoInProgress: action.payload.flag };
|
return { ...state, stopAllVideoInProgress: action.payload.flag };
|
||||||
|
|
||||||
|
case 'CLOSE_MEETING_IN_PROGRESS':
|
||||||
|
return { ...state, closeMeetingInProgress: action.payload.flag };
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1105,6 +1105,33 @@ class Room extends EventEmitter
|
||||||
break;
|
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':
|
case 'moderator:kickPeer':
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue