Refine PARTICIPANT_LEFT for ID collisions
If the ID of a remote participant was the same as the ID of the local participant (across multiple conferences), removing the remote participant on PARTICIPANT_LEFT would remove the local participant. Like the preceding commit "ref(base/conference): clear the 'conference' field on WILL_LEAVE", this commit is part of the story how we are to deal with conferences which take noticeable time to leave.
This commit is contained in:
parent
8cfc83f18c
commit
c672ffd435
|
@ -48,6 +48,7 @@ export const PARTICIPANT_DISPLAY_NAME_CHANGED
|
||||||
*
|
*
|
||||||
* {
|
* {
|
||||||
* type: PARTICIPANT_ID_CHANGED,
|
* type: PARTICIPANT_ID_CHANGED,
|
||||||
|
* conference: JitsiConference
|
||||||
* newValue: string,
|
* newValue: string,
|
||||||
* oldValue: string
|
* oldValue: string
|
||||||
* }
|
* }
|
||||||
|
|
|
@ -97,6 +97,10 @@ export function localParticipantIdChanged(id) {
|
||||||
if (participant) {
|
if (participant) {
|
||||||
return dispatch({
|
return dispatch({
|
||||||
type: PARTICIPANT_ID_CHANGED,
|
type: PARTICIPANT_ID_CHANGED,
|
||||||
|
|
||||||
|
// XXX A participant is identified by an id-conference pair.
|
||||||
|
// Only the local participant is with an undefined conference.
|
||||||
|
conference: undefined,
|
||||||
newValue: id,
|
newValue: id,
|
||||||
oldValue: participant.id
|
oldValue: participant.id
|
||||||
});
|
});
|
||||||
|
|
|
@ -84,8 +84,13 @@ ReducerRegistry.register('features/base/participants', (state = [], action) => {
|
||||||
return state.filter(p =>
|
return state.filter(p =>
|
||||||
!(
|
!(
|
||||||
p.id === id
|
p.id === id
|
||||||
&& (p.local
|
|
||||||
|| (conference && p.conference === conference))));
|
// XXX Do not allow collisions in the IDs of the local
|
||||||
|
// participant and a remote participant cause the removal of
|
||||||
|
// the local participant when the remote participant's
|
||||||
|
// removal is requested.
|
||||||
|
&& p.conference === conference
|
||||||
|
&& (conference || p.local)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,14 +116,21 @@ function _participant(state: Object = {}, action) {
|
||||||
return (
|
return (
|
||||||
set(state, 'dominantSpeaker', state.id === action.participant.id));
|
set(state, 'dominantSpeaker', state.id === action.participant.id));
|
||||||
|
|
||||||
case PARTICIPANT_ID_CHANGED:
|
case PARTICIPANT_ID_CHANGED: {
|
||||||
if (state.id === action.oldValue) {
|
// A participant is identified by an id-conference pair. Only the local
|
||||||
|
// participant is with an undefined conference.
|
||||||
|
const { conference } = action;
|
||||||
|
|
||||||
|
if (state.id === action.oldValue
|
||||||
|
&& state.conference === conference
|
||||||
|
&& (conference || state.local)) {
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
id: action.newValue
|
id: action.newValue
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case PARTICIPANT_UPDATED: {
|
case PARTICIPANT_UPDATED: {
|
||||||
const { participant } = action; // eslint-disable-line no-shadow
|
const { participant } = action; // eslint-disable-line no-shadow
|
||||||
|
|
Loading…
Reference in New Issue