If peer gets role PROMOTE_PEER, notify peer of all peers in lobby, fixes #208
parent
4d3ebefc92
commit
a8dabf7343
|
|
@ -2053,6 +2053,8 @@ export default class RoomClient
|
|||
store.dispatch(
|
||||
roomActions.setToolbarsVisible(true));
|
||||
|
||||
this._soundNotification();
|
||||
|
||||
store.dispatch(requestActions.notify(
|
||||
{
|
||||
text : intl.formatMessage({
|
||||
|
|
@ -2064,6 +2066,43 @@ export default class RoomClient
|
|||
break;
|
||||
}
|
||||
|
||||
case 'parkedPeers':
|
||||
{
|
||||
const { lobbyPeers } = notification.data;
|
||||
|
||||
if (lobbyPeers.length > 0)
|
||||
{
|
||||
lobbyPeers.forEach((peer) =>
|
||||
{
|
||||
store.dispatch(
|
||||
lobbyPeerActions.addLobbyPeer(peer.peerId));
|
||||
store.dispatch(
|
||||
lobbyPeerActions.setLobbyPeerDisplayName(
|
||||
peer.displayName,
|
||||
peer.peerId
|
||||
)
|
||||
);
|
||||
store.dispatch(
|
||||
lobbyPeerActions.setLobbyPeerPicture(peer.picture));
|
||||
});
|
||||
|
||||
store.dispatch(
|
||||
roomActions.setToolbarsVisible(true));
|
||||
|
||||
this._soundNotification();
|
||||
|
||||
store.dispatch(requestActions.notify(
|
||||
{
|
||||
text : intl.formatMessage({
|
||||
id : 'room.newLobbyPeer',
|
||||
defaultMessage : 'New participant entered the lobby'
|
||||
})
|
||||
}));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 'lobby:peerClosed':
|
||||
{
|
||||
const { peerId } = notification.data;
|
||||
|
|
|
|||
|
|
@ -530,6 +530,17 @@ class Room extends EventEmitter
|
|||
peerId : peer.id,
|
||||
role : newRole
|
||||
}, true, true);
|
||||
|
||||
// Got permission to promote peers, notify peer of
|
||||
// peers in lobby
|
||||
if (permissionsFromRoles.PROMOTE_PEER.includes(newRole))
|
||||
{
|
||||
const lobbyPeers = this._lobby.peerList();
|
||||
|
||||
lobbyPeers.length > 0 && this._notification(peer.socket, 'parkedPeers', {
|
||||
lobbyPeers
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
peer.on('lostRole', ({ oldRole }) =>
|
||||
|
|
|
|||
Loading…
Reference in New Issue