Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

Refine PARTICIPANT_LEFT for ID collisions

Lyubo Marinovc672ffd43520
diff --git a/react/features/base/participants/actionTypes.js b/react/features/base/participants/actionTypes.js
index 189fb0f373..533727c512 100644
--- a/react/features/base/participants/actionTypes.js
+++ b/react/features/base/participants/actionTypes.js
@@ -48,6 +48,7 @@ export const PARTICIPANT_DISPLAY_NAME_CHANGED
*
* {
* type: PARTICIPANT_ID_CHANGED,
+ * conference: JitsiConference
* newValue: string,
* oldValue: string
* }
diff --git a/react/features/base/participants/actions.js b/react/features/base/participants/actions.js
index a0b5b92a5f..137a4646dc 100644
--- a/react/features/base/participants/actions.js
+++ b/react/features/base/participants/actions.js
@@ -97,6 +97,10 @@ export function localParticipantIdChanged(id) {
if (participant) {
return dispatch({
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,
oldValue: participant.id
});
diff --git a/react/features/base/participants/reducer.js b/react/features/base/participants/reducer.js
index cd72174798..9dc2f0ff84 100644
--- a/react/features/base/participants/reducer.js
+++ b/react/features/base/participants/reducer.js
@@ -84,8 +84,13 @@ ReducerRegistry.register('features/base/participants', (state = [], action) => {
return state.filter(p =>
!(
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 (
set(state, 'dominantSpeaker', state.id === action.participant.id));
- case PARTICIPANT_ID_CHANGED:
- if (state.id === action.oldValue) {
+ case PARTICIPANT_ID_CHANGED: {
+ // 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 {
...state,
id: action.newValue
};
}
break;
+ }
case PARTICIPANT_UPDATED: {
const { participant } = action; // eslint-disable-line no-shadow