Give client correct authentication status when joining a room. Fixes #166

This commit is contained in:
Håvar Aambø Fosstveit
2020-04-01 21:58:41 +02:00
parent b19add7599
commit fa032036d7
4 changed files with 37 additions and 7 deletions
+19
View File
@@ -25,6 +25,8 @@ class Peer extends EventEmitter
this._inLobby = false;
this._authenticated = false;
this._roles = [ userRoles.ALL ];
this._displayName = false;
@@ -146,6 +148,23 @@ class Peer extends EventEmitter
this._inLobby = inLobby;
}
get authenticated()
{
return this._authenticated;
}
set authenticated(authenticated)
{
if (authenticated !== this._authenticated)
{
const oldAuthenticated = this._authenticated;
this._authenticated = authenticated;
this.emit('authenticationChanged', { oldAuthenticated });
}
}
get roles()
{
return this._roles;
+3 -2
View File
@@ -554,8 +554,9 @@ class Room extends EventEmitter
.map((joinedPeer) => (joinedPeer.peerInfo));
cb(null, {
roles : peer.roles,
peers : peerInfos
roles : peer.roles,
peers : peerInfos,
authenticated : peer.authenticated
});
// Mark the new Peer as joined.