fix: picture update from Lobby

master
Stefan Otto 2019-10-31 01:44:06 +01:00
parent 6c07f89ab1
commit d49ef4e65f
5 changed files with 33 additions and 5 deletions

View File

@ -331,7 +331,7 @@ export default class RoomClient
text : 'You are logged in.' text : 'You are logged in.'
})); }));
this.changeDisplayName(displayName); this.changeDisplayName(displayName);
this.changePicture(picture); this.changePicture(picture)
} }
_soundNotification() _soundNotification()
@ -658,6 +658,8 @@ export default class RoomClient
stateActions.addLobbyPeer(peer.peerId)); stateActions.addLobbyPeer(peer.peerId));
store.dispatch( store.dispatch(
stateActions.setLobbyPeerDisplayName(peer.displayName)); stateActions.setLobbyPeerDisplayName(peer.displayName));
store.dispatch(
stateActions.setLobbyPeerPicture(peer.picture));
}); });
(accessCode != null) && store.dispatch( (accessCode != null) && store.dispatch(
@ -1415,6 +1417,21 @@ export default class RoomClient
break; break;
} }
case 'lobby:changePicture':
{
const { peerId, picture } = notification.data;
store.dispatch(
stateActions.setLobbyPeerPicture(picture, peerId));
store.dispatch(requestActions.notify(
{
text : `Participant in lobby changed picture.`
}));
break;
}
case 'setAccessCode': case 'setAccessCode':
{ {
const { accessCode } = notification.data; const { accessCode } = notification.data;

View File

@ -461,6 +461,14 @@ export const setLobbyPeerDisplayName = (displayName, peerId) =>
}; };
}; };
export const setLobbyPeerPicture = (picture, peerId) =>
{
return {
type : 'SET_LOBBY_PEER_PICTURE',
payload : { picture, peerId }
};
};
export const setLobbyPeerPromotionInProgress = (peerId, flag) => export const setLobbyPeerPromotionInProgress = (peerId, flag) =>
{ {
return { return {

View File

@ -8,6 +8,9 @@ const lobbyPeer = (state = {}, action) =>
case 'SET_LOBBY_PEER_DISPLAY_NAME': case 'SET_LOBBY_PEER_DISPLAY_NAME':
return { ...state, displayName: action.payload.displayName }; return { ...state, displayName: action.payload.displayName };
case 'SET_LOBBY_PEER_PICTURE':
return { ...state, picture: action.payload.picture };
case 'SET_LOBBY_PEER_PROMOTION_IN_PROGRESS': case 'SET_LOBBY_PEER_PROMOTION_IN_PROGRESS':
return { ...state, promotionInProgress: action.payload.flag }; return { ...state, promotionInProgress: action.payload.flag };

View File

@ -91,9 +91,6 @@ class Lobby extends EventEmitter
this._notification(peer.socket, 'enteredLobby'); this._notification(peer.socket, 'enteredLobby');
if (config.requireSignInToAccess && !peer.authenticated && !super.isLocked())
this._notification(peer.socket, 'signInRequired');
this._peers.set(peer.id, peer); this._peers.set(peer.id, peer);
peer.on('authenticationChanged', () => peer.on('authenticationChanged', () =>

View File

@ -133,6 +133,9 @@ class Room extends EventEmitter
{ {
this._parkPeer(peer); this._parkPeer(peer);
if (!this._locked)
this._notification(peer.socket, 'signInRequired');
return; return;
} }