A button to promote all peers from lobby, fixes #287
parent
a00d33ee4b
commit
a1ed79c5db
|
|
@ -1274,6 +1274,26 @@ export default class RoomClient
|
|||
roomActions.setSelectedPeer(peerId));
|
||||
}
|
||||
|
||||
async promoteAllLobbyPeers()
|
||||
{
|
||||
logger.debug('promoteAllLobbyPeers()');
|
||||
|
||||
store.dispatch(
|
||||
roomActions.setLobbyPeersPromotionInProgress(true));
|
||||
|
||||
try
|
||||
{
|
||||
await this.sendRequest('promoteAllPeers');
|
||||
}
|
||||
catch (error)
|
||||
{
|
||||
logger.error('promoteAllLobbyPeers() [error:"%o"]', error);
|
||||
}
|
||||
|
||||
store.dispatch(
|
||||
roomActions.setLobbyPeersPromotionInProgress(false));
|
||||
}
|
||||
|
||||
async promoteLobbyPeer(peerId)
|
||||
{
|
||||
logger.debug('promoteLobbyPeer() [peerId:"%s"]', peerId);
|
||||
|
|
|
|||
|
|
@ -123,6 +123,12 @@ export const toggleConsumerFullscreen = (consumerId) =>
|
|||
payload : { consumerId }
|
||||
});
|
||||
|
||||
export const setLobbyPeersPromotionInProgress = (flag) =>
|
||||
({
|
||||
type : 'SET_LOBBY_PEERS_PROMOTION_IN_PROGRESS',
|
||||
payload : { flag }
|
||||
});
|
||||
|
||||
export const setMuteAllInProgress = (flag) =>
|
||||
({
|
||||
type : 'MUTE_ALL_IN_PROGRESS',
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ const ListLobbyPeer = (props) =>
|
|||
const {
|
||||
roomClient,
|
||||
peer,
|
||||
promotionInProgress,
|
||||
canPromote,
|
||||
classes
|
||||
} = props;
|
||||
|
|
@ -55,7 +56,11 @@ const ListLobbyPeer = (props) =>
|
|||
})}
|
||||
>
|
||||
<IconButton
|
||||
disabled={!canPromote || peer.promotionInProgress}
|
||||
disabled={
|
||||
!canPromote ||
|
||||
peer.promotionInProgress ||
|
||||
promotionInProgress
|
||||
}
|
||||
onClick={(e) =>
|
||||
{
|
||||
e.stopPropagation();
|
||||
|
|
@ -71,18 +76,20 @@ const ListLobbyPeer = (props) =>
|
|||
|
||||
ListLobbyPeer.propTypes =
|
||||
{
|
||||
roomClient : PropTypes.any.isRequired,
|
||||
advancedMode : PropTypes.bool,
|
||||
peer : PropTypes.object.isRequired,
|
||||
canPromote : PropTypes.bool.isRequired,
|
||||
classes : PropTypes.object.isRequired
|
||||
roomClient : PropTypes.any.isRequired,
|
||||
advancedMode : PropTypes.bool,
|
||||
peer : PropTypes.object.isRequired,
|
||||
promotionInProgress : PropTypes.bool.isRequired,
|
||||
canPromote : PropTypes.bool.isRequired,
|
||||
classes : PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
const mapStateToProps = (state, { id }) =>
|
||||
{
|
||||
return {
|
||||
peer : state.lobbyPeers[id],
|
||||
canPromote :
|
||||
peer : state.lobbyPeers[id],
|
||||
promotionInProgress : state.room.lobbyPeersPromotionInProgress,
|
||||
canPromote :
|
||||
state.me.roles.some((role) =>
|
||||
state.room.permissionsFromRoles.PROMOTE_PEER.includes(role))
|
||||
};
|
||||
|
|
@ -97,6 +104,8 @@ export default withRoomContext(connect(
|
|||
{
|
||||
return (
|
||||
prev.room.permissionsFromRoles === next.room.permissionsFromRoles &&
|
||||
prev.room.lobbyPeersPromotionInProgress ===
|
||||
next.room.lobbyPeersPromotionInProgress &&
|
||||
prev.me.roles === next.me.roles &&
|
||||
prev.lobbyPeers === next.lobbyPeers
|
||||
);
|
||||
|
|
|
|||
|
|
@ -51,9 +51,11 @@ const styles = (theme) =>
|
|||
});
|
||||
|
||||
const LockDialog = ({
|
||||
roomClient,
|
||||
room,
|
||||
handleCloseLockDialog,
|
||||
lobbyPeers,
|
||||
canPromote,
|
||||
classes
|
||||
}) =>
|
||||
{
|
||||
|
|
@ -102,6 +104,20 @@ const LockDialog = ({
|
|||
</DialogContent>
|
||||
}
|
||||
<DialogActions>
|
||||
<Button
|
||||
disabled={
|
||||
lobbyPeers.length === 0 ||
|
||||
!canPromote ||
|
||||
room.lobbyPeersPromotionInProgress
|
||||
}
|
||||
onClick={() => roomClient.promoteAllLobbyPeers()}
|
||||
color='primary'
|
||||
>
|
||||
<FormattedMessage
|
||||
id='label.promoteAllPeers'
|
||||
defaultMessage='Promote all'
|
||||
/>
|
||||
</Button>
|
||||
<Button onClick={() => handleCloseLockDialog(false)} color='primary'>
|
||||
<FormattedMessage
|
||||
id='label.close'
|
||||
|
|
@ -115,10 +131,12 @@ const LockDialog = ({
|
|||
|
||||
LockDialog.propTypes =
|
||||
{
|
||||
roomClient : PropTypes.object.isRequired,
|
||||
room : appPropTypes.Room.isRequired,
|
||||
handleCloseLockDialog : PropTypes.func.isRequired,
|
||||
handleAccessCode : PropTypes.func.isRequired,
|
||||
lobbyPeers : PropTypes.array,
|
||||
canPromote : PropTypes.bool,
|
||||
classes : PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
|
|
@ -126,7 +144,10 @@ const mapStateToProps = (state) =>
|
|||
{
|
||||
return {
|
||||
room : state.room,
|
||||
lobbyPeers : lobbyPeersKeySelector(state)
|
||||
lobbyPeers : lobbyPeersKeySelector(state),
|
||||
canPromote :
|
||||
state.me.roles.some((role) =>
|
||||
state.room.permissionsFromRoles.PROMOTE_PEER.includes(role))
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -144,6 +165,7 @@ export default withRoomContext(connect(
|
|||
{
|
||||
return (
|
||||
prev.room === next.room &&
|
||||
prev.me.roles === next.me.roles &&
|
||||
prev.lobbyPeers === next.lobbyPeers
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,36 +1,37 @@
|
|||
const initialState =
|
||||
{
|
||||
name : '',
|
||||
name : '',
|
||||
// new/connecting/connected/disconnected/closed,
|
||||
state : 'new',
|
||||
locked : false,
|
||||
inLobby : false,
|
||||
signInRequired : false,
|
||||
state : 'new',
|
||||
locked : false,
|
||||
inLobby : false,
|
||||
signInRequired : false,
|
||||
// access code to the room if locked and joinByAccessCode == true
|
||||
accessCode : '',
|
||||
accessCode : '',
|
||||
// if true: accessCode is a possibility to open the room
|
||||
joinByAccessCode : true,
|
||||
activeSpeakerId : null,
|
||||
torrentSupport : false,
|
||||
showSettings : false,
|
||||
fullScreenConsumer : null, // ConsumerID
|
||||
windowConsumer : null, // ConsumerID
|
||||
toolbarsVisible : true,
|
||||
mode : window.config.defaultLayout || 'democratic',
|
||||
selectedPeerId : null,
|
||||
spotlights : [],
|
||||
settingsOpen : false,
|
||||
extraVideoOpen : false,
|
||||
currentSettingsTab : 'media', // media, appearence, advanced
|
||||
lockDialogOpen : false,
|
||||
joined : false,
|
||||
muteAllInProgress : false,
|
||||
stopAllVideoInProgress : false,
|
||||
closeMeetingInProgress : false,
|
||||
clearChatInProgress : false,
|
||||
clearFileSharingInProgress : false,
|
||||
userRoles : { NORMAL: 'normal' }, // Default role
|
||||
permissionsFromRoles : {
|
||||
joinByAccessCode : true,
|
||||
activeSpeakerId : null,
|
||||
torrentSupport : false,
|
||||
showSettings : false,
|
||||
fullScreenConsumer : null, // ConsumerID
|
||||
windowConsumer : null, // ConsumerID
|
||||
toolbarsVisible : true,
|
||||
mode : window.config.defaultLayout || 'democratic',
|
||||
selectedPeerId : null,
|
||||
spotlights : [],
|
||||
settingsOpen : false,
|
||||
extraVideoOpen : false,
|
||||
currentSettingsTab : 'media', // media, appearence, advanced
|
||||
lockDialogOpen : false,
|
||||
joined : false,
|
||||
muteAllInProgress : false,
|
||||
lobbyPeersPromotionInProgress : false,
|
||||
stopAllVideoInProgress : false,
|
||||
closeMeetingInProgress : false,
|
||||
clearChatInProgress : false,
|
||||
clearFileSharingInProgress : false,
|
||||
userRoles : { NORMAL: 'normal' }, // Default role
|
||||
permissionsFromRoles : {
|
||||
CHANGE_ROOM_LOCK : [],
|
||||
PROMOTE_PEER : [],
|
||||
SEND_CHAT : [],
|
||||
|
|
@ -199,6 +200,9 @@ const room = (state = initialState, action) =>
|
|||
return { ...state, spotlights };
|
||||
}
|
||||
|
||||
case 'SET_LOBBY_PEERS_PROMOTION_IN_PROGRESS':
|
||||
return { ...state, lobbyPeersPromotionInProgress: action.payload.flag };
|
||||
|
||||
case 'MUTE_ALL_IN_PROGRESS':
|
||||
return { ...state, muteAllInProgress: action.payload.flag };
|
||||
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@
|
|||
"label.appearence": null,
|
||||
"label.advanced": null,
|
||||
"label.addVideo": null,
|
||||
"label.promoteAllPeers": null,
|
||||
|
||||
"settings.settings": "设置",
|
||||
"settings.camera": "视频设备",
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@
|
|||
"label.appearence": null,
|
||||
"label.advanced": null,
|
||||
"label.addVideo": null,
|
||||
"label.promoteAllPeers": null,
|
||||
|
||||
"settings.settings": "Nastavení",
|
||||
"settings.camera": "Kamera",
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@
|
|||
"label.appearence": null,
|
||||
"label.advanced": null,
|
||||
"label.addVideo": null,
|
||||
"label.promoteAllPeers": null,
|
||||
|
||||
"settings.settings": "Einstellungen",
|
||||
"settings.camera": "Kamera",
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@
|
|||
"label.appearence": null,
|
||||
"label.advanced": null,
|
||||
"label.addVideo": null,
|
||||
"label.promoteAllPeers": null,
|
||||
|
||||
"settings.settings": "Indstillinger",
|
||||
"settings.camera": "Kamera",
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@
|
|||
"label.appearence": null,
|
||||
"label.advanced": null,
|
||||
"label.addVideo": null,
|
||||
"label.promoteAllPeers": null,
|
||||
|
||||
"settings.settings": "Ρυθμίσεις",
|
||||
"settings.camera": "Κάμερα",
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@
|
|||
"label.appearence": "Appearence",
|
||||
"label.advanced": "Advanced",
|
||||
"label.addVideo": "Add video",
|
||||
"label.promoteAllPeers": "Promote all",
|
||||
|
||||
"settings.settings": "Settings",
|
||||
"settings.camera": "Camera",
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@
|
|||
"label.appearence": null,
|
||||
"label.advanced": null,
|
||||
"label.addVideo": null,
|
||||
"label.promoteAllPeers": null,
|
||||
|
||||
"settings.settings": "Ajustes",
|
||||
"settings.camera": "Cámara",
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@
|
|||
"label.appearence": null,
|
||||
"label.advanced": null,
|
||||
"label.addVideo": null,
|
||||
"label.promoteAllPeers": null,
|
||||
|
||||
"settings.settings": "Paramètres",
|
||||
"settings.camera": "Caméra",
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@
|
|||
"label.appearence": null,
|
||||
"label.advanced": null,
|
||||
"label.addVideo": null,
|
||||
"label.promoteAllPeers": null,
|
||||
|
||||
"settings.settings": "Postavke",
|
||||
"settings.camera": "Kamera",
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@
|
|||
"label.appearence": null,
|
||||
"label.advanced": null,
|
||||
"label.addVideo": null,
|
||||
"label.promoteAllPeers": null,
|
||||
|
||||
"settings.settings": "Beállítások",
|
||||
"settings.camera": "Kamera",
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@
|
|||
"label.appearence": null,
|
||||
"label.advanced": null,
|
||||
"label.addVideo": null,
|
||||
"label.promoteAllPeers": null,
|
||||
|
||||
"settings.settings": "Impostazioni",
|
||||
"settings.camera": "Videocamera",
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@
|
|||
"label.appearence": "Utseende",
|
||||
"label.advanced": "Avansert",
|
||||
"label.addVideo": "Legg til video",
|
||||
"label.promoteAllPeers": "Slipp inn alle",
|
||||
|
||||
"settings.settings": "Innstillinger",
|
||||
"settings.camera": "Kamera",
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@
|
|||
"label.appearence": null,
|
||||
"label.advanced": null,
|
||||
"label.addVideo": null,
|
||||
"label.promoteAllPeers": null,
|
||||
|
||||
"settings.settings": "Ustawienia",
|
||||
"settings.camera": "Kamera",
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@
|
|||
"label.appearence": null,
|
||||
"label.advanced": null,
|
||||
"label.addVideo": null,
|
||||
"label.promoteAllPeers": null,
|
||||
|
||||
"settings.settings": "Definições",
|
||||
"settings.camera": "Camera",
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@
|
|||
"label.appearence": null,
|
||||
"label.advanced": null,
|
||||
"label.addVideo": null,
|
||||
"label.promoteAllPeers": null,
|
||||
|
||||
"settings.settings": "Setări",
|
||||
"settings.camera": "Cameră video",
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@
|
|||
"label.appearence": null,
|
||||
"label.advanced": null,
|
||||
"label.addVideo": null,
|
||||
"label.promoteAllPeers": null,
|
||||
|
||||
"settings.settings": "Ayarlar",
|
||||
"settings.camera": "Kamera",
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@
|
|||
"label.appearence": null,
|
||||
"label.advanced": null,
|
||||
"label.addVideo": null,
|
||||
"label.promoteAllPeers": null,
|
||||
|
||||
"settings.settings": "Налаштування",
|
||||
"settings.camera": "Камера",
|
||||
|
|
|
|||
|
|
@ -63,8 +63,8 @@ class Lobby extends EventEmitter
|
|||
|
||||
for (const peer in this._peers)
|
||||
{
|
||||
if (peer.socket)
|
||||
this.promotePeer(peer.id);
|
||||
if (!this._peers[peer].closed)
|
||||
this.promotePeer(peer);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue