If peer gets role PROMOTE_PEER, notify peer of all peers in lobby, fixes #208
parent
4d3ebefc92
commit
a8dabf7343
|
|
@ -2052,6 +2052,8 @@ export default class RoomClient
|
||||||
lobbyPeerActions.addLobbyPeer(peerId));
|
lobbyPeerActions.addLobbyPeer(peerId));
|
||||||
store.dispatch(
|
store.dispatch(
|
||||||
roomActions.setToolbarsVisible(true));
|
roomActions.setToolbarsVisible(true));
|
||||||
|
|
||||||
|
this._soundNotification();
|
||||||
|
|
||||||
store.dispatch(requestActions.notify(
|
store.dispatch(requestActions.notify(
|
||||||
{
|
{
|
||||||
|
|
@ -2063,6 +2065,43 @@ export default class RoomClient
|
||||||
|
|
||||||
break;
|
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':
|
case 'lobby:peerClosed':
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -530,6 +530,17 @@ class Room extends EventEmitter
|
||||||
peerId : peer.id,
|
peerId : peer.id,
|
||||||
role : newRole
|
role : newRole
|
||||||
}, true, true);
|
}, 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 }) =>
|
peer.on('lostRole', ({ oldRole }) =>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue