diff --git a/app/lib/RoomClient.js b/app/lib/RoomClient.js index 7bf0b3e..380d75c 100644 --- a/app/lib/RoomClient.js +++ b/app/lib/RoomClient.js @@ -349,6 +349,8 @@ export default class RoomClient { const speakers = this._lastN.slice(0, this._lastNSpeakers); + this._dispatch(stateActions.setLastN(speakers)); + speakers.forEach((peerName) => { const peer = this._room.getPeerByName(peerName); @@ -1196,6 +1198,7 @@ export default class RoomClient if (index === -1) // We don't have this peer in the list, add { this._lastN.push(peer.name); + this.updateSpeakers(); } this._handlePeer(peer); diff --git a/app/lib/redux/reducers/room.js b/app/lib/redux/reducers/room.js index 19872ec..dd99318 100644 --- a/app/lib/redux/reducers/room.js +++ b/app/lib/redux/reducers/room.js @@ -8,7 +8,8 @@ const initialState = fullScreenConsumer : null, // ConsumerID toolbarsVisible : true, mode : 'democratic', - selectedPeerName : null + selectedPeerName : null, + lastN : null }; const room = (state = initialState, action) => @@ -83,6 +84,13 @@ const room = (state = initialState, action) => }; } + case 'SET_LASTN': + { + const { lastN } = action.payload; + + return { ...state, lastN }; + } + default: return state; } diff --git a/app/lib/redux/stateActions.js b/app/lib/redux/stateActions.js index 1d8d09f..bc19deb 100644 --- a/app/lib/redux/stateActions.js +++ b/app/lib/redux/stateActions.js @@ -474,7 +474,14 @@ export const loggedIn = () => type : 'LOGGED_IN' }); -export const setSelectedPeer = (selectedPeerName) => ({ - type : 'SET_SELECTED_PEER', - payload : { selectedPeerName } -}); +export const setSelectedPeer = (selectedPeerName) => + ({ + type : 'SET_SELECTED_PEER', + payload : { selectedPeerName } + }); + +export const setLastN = (lastN) => + ({ + type : 'SET_LASTN', + payload : { lastN } + });