Remove getServerHistory, and use 'join' callback instead.
parent
a8dabf7343
commit
881eac741a
|
|
@ -844,62 +844,6 @@ export default class RoomClient
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async getServerHistory()
|
|
||||||
{
|
|
||||||
logger.debug('getServerHistory()');
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
const {
|
|
||||||
chatHistory,
|
|
||||||
fileHistory,
|
|
||||||
lastNHistory,
|
|
||||||
locked,
|
|
||||||
lobbyPeers,
|
|
||||||
accessCode
|
|
||||||
} = await this.sendRequest('serverHistory');
|
|
||||||
|
|
||||||
(chatHistory.length > 0) && store.dispatch(
|
|
||||||
chatActions.addChatHistory(chatHistory));
|
|
||||||
|
|
||||||
(fileHistory.length > 0) && store.dispatch(
|
|
||||||
fileActions.addFileHistory(fileHistory));
|
|
||||||
|
|
||||||
if (lastNHistory.length > 0)
|
|
||||||
{
|
|
||||||
logger.debug('Got lastNHistory');
|
|
||||||
|
|
||||||
// Remove our self from list
|
|
||||||
const index = lastNHistory.indexOf(this._peerId);
|
|
||||||
|
|
||||||
lastNHistory.splice(index, 1);
|
|
||||||
|
|
||||||
this._spotlights.addSpeakerList(lastNHistory);
|
|
||||||
}
|
|
||||||
|
|
||||||
locked ?
|
|
||||||
store.dispatch(roomActions.setRoomLocked()) :
|
|
||||||
store.dispatch(roomActions.setRoomUnLocked());
|
|
||||||
|
|
||||||
(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));
|
|
||||||
});
|
|
||||||
|
|
||||||
(accessCode != null) && store.dispatch(
|
|
||||||
roomActions.setAccessCode(accessCode));
|
|
||||||
}
|
|
||||||
catch (error)
|
|
||||||
{
|
|
||||||
logger.error('getServerHistory() | failed: %o', error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async muteMic()
|
async muteMic()
|
||||||
{
|
{
|
||||||
logger.debug('muteMic()');
|
logger.debug('muteMic()');
|
||||||
|
|
@ -2733,7 +2677,13 @@ export default class RoomClient
|
||||||
peers,
|
peers,
|
||||||
tracker,
|
tracker,
|
||||||
permissionsFromRoles,
|
permissionsFromRoles,
|
||||||
userRoles
|
userRoles,
|
||||||
|
chatHistory,
|
||||||
|
fileHistory,
|
||||||
|
lastNHistory,
|
||||||
|
locked,
|
||||||
|
lobbyPeers,
|
||||||
|
accessCode
|
||||||
} = await this.sendRequest(
|
} = await this.sendRequest(
|
||||||
'join',
|
'join',
|
||||||
{
|
{
|
||||||
|
|
@ -2788,6 +2738,38 @@ export default class RoomClient
|
||||||
this.updateSpotlights(spotlights);
|
this.updateSpotlights(spotlights);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
(chatHistory.length > 0) && store.dispatch(
|
||||||
|
chatActions.addChatHistory(chatHistory));
|
||||||
|
|
||||||
|
(fileHistory.length > 0) && store.dispatch(
|
||||||
|
fileActions.addFileHistory(fileHistory));
|
||||||
|
|
||||||
|
if (lastNHistory.length > 0)
|
||||||
|
{
|
||||||
|
logger.debug('_joinRoom() | got lastN history');
|
||||||
|
|
||||||
|
this._spotlights.addSpeakerList(
|
||||||
|
lastNHistory.filter((peerId) => peerId !== this._peerId)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
locked ?
|
||||||
|
store.dispatch(roomActions.setRoomLocked()) :
|
||||||
|
store.dispatch(roomActions.setRoomUnLocked());
|
||||||
|
|
||||||
|
(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));
|
||||||
|
});
|
||||||
|
|
||||||
|
(accessCode != null) && store.dispatch(
|
||||||
|
roomActions.setAccessCode(accessCode));
|
||||||
|
|
||||||
// Don't produce if explicitly requested to not to do it.
|
// Don't produce if explicitly requested to not to do it.
|
||||||
if (this._produce)
|
if (this._produce)
|
||||||
{
|
{
|
||||||
|
|
@ -2821,8 +2803,6 @@ export default class RoomClient
|
||||||
// Clean all the existing notifications.
|
// Clean all the existing notifications.
|
||||||
store.dispatch(notificationActions.removeAllNotifications());
|
store.dispatch(notificationActions.removeAllNotifications());
|
||||||
|
|
||||||
this.getServerHistory();
|
|
||||||
|
|
||||||
store.dispatch(requestActions.notify(
|
store.dispatch(requestActions.notify(
|
||||||
{
|
{
|
||||||
text : intl.formatMessage({
|
text : intl.formatMessage({
|
||||||
|
|
|
||||||
|
|
@ -597,13 +597,21 @@ class Room extends EventEmitter
|
||||||
.filter((joinedPeer) => joinedPeer.id !== peer.id)
|
.filter((joinedPeer) => joinedPeer.id !== peer.id)
|
||||||
.map((joinedPeer) => (joinedPeer.peerInfo));
|
.map((joinedPeer) => (joinedPeer.peerInfo));
|
||||||
|
|
||||||
|
const lobbyPeers = this._lobby.peerList();
|
||||||
|
|
||||||
cb(null, {
|
cb(null, {
|
||||||
roles : peer.roles,
|
roles : peer.roles,
|
||||||
peers : peerInfos,
|
peers : peerInfos,
|
||||||
tracker : config.fileTracker,
|
tracker : config.fileTracker,
|
||||||
authenticated : peer.authenticated,
|
authenticated : peer.authenticated,
|
||||||
permissionsFromRoles : permissionsFromRoles,
|
permissionsFromRoles : permissionsFromRoles,
|
||||||
userRoles : userRoles
|
userRoles : userRoles,
|
||||||
|
chatHistory : this._chatHistory,
|
||||||
|
fileHistory : this._fileHistory,
|
||||||
|
lastNHistory : this._lastN,
|
||||||
|
locked : this._locked,
|
||||||
|
lobbyPeers : lobbyPeers,
|
||||||
|
accessCode : this._accessCode
|
||||||
});
|
});
|
||||||
|
|
||||||
// Mark the new Peer as joined.
|
// Mark the new Peer as joined.
|
||||||
|
|
@ -1078,26 +1086,6 @@ class Room extends EventEmitter
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'serverHistory':
|
|
||||||
{
|
|
||||||
// Return to sender
|
|
||||||
const lobbyPeers = this._lobby.peerList();
|
|
||||||
|
|
||||||
cb(
|
|
||||||
null,
|
|
||||||
{
|
|
||||||
chatHistory : this._chatHistory,
|
|
||||||
fileHistory : this._fileHistory,
|
|
||||||
lastNHistory : this._lastN,
|
|
||||||
locked : this._locked,
|
|
||||||
lobbyPeers : lobbyPeers,
|
|
||||||
accessCode : this._accessCode
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 'lockRoom':
|
case 'lockRoom':
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue