Associate remote participant w/ JitsiConference (_LEFT)
The commit message of "Associate remote participant w/ JitsiConference (_JOINED)" explains the motivation for this commit.
This commit is contained in:
parent
983e62ffe9
commit
37cd5bb5b9
|
@ -1710,7 +1710,7 @@ export default {
|
||||||
if (user.isHidden()) {
|
if (user.isHidden()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
APP.store.dispatch(participantLeft(id, user));
|
APP.store.dispatch(participantLeft(id, room));
|
||||||
logger.log('USER %s LEFT', id, user);
|
logger.log('USER %s LEFT', id, user);
|
||||||
APP.API.notifyUserLeft(id);
|
APP.API.notifyUserLeft(id);
|
||||||
APP.UI.removeUser(id, user.getDisplayName());
|
APP.UI.removeUser(id, user.getDisplayName());
|
||||||
|
|
|
@ -517,7 +517,7 @@ export default class SharedVideoManager {
|
||||||
UIEvents.UPDATE_SHARED_VIDEO, null, 'removed');
|
UIEvents.UPDATE_SHARED_VIDEO, null, 'removed');
|
||||||
});
|
});
|
||||||
|
|
||||||
APP.store.dispatch(participantLeft(this.url));
|
APP.store.dispatch(participantLeft(this.url, APP.conference));
|
||||||
|
|
||||||
this.url = null;
|
this.url = null;
|
||||||
this.isSharedVideoShown = false;
|
this.isSharedVideoShown = false;
|
||||||
|
|
|
@ -147,7 +147,7 @@ function _addConferenceListeners(conference, dispatch) {
|
||||||
})));
|
})));
|
||||||
conference.on(
|
conference.on(
|
||||||
JitsiConferenceEvents.USER_LEFT,
|
JitsiConferenceEvents.USER_LEFT,
|
||||||
(...args) => dispatch(participantLeft(...args)));
|
id => dispatch(participantLeft(id, conference)));
|
||||||
conference.on(
|
conference.on(
|
||||||
JitsiConferenceEvents.USER_ROLE_CHANGED,
|
JitsiConferenceEvents.USER_ROLE_CHANGED,
|
||||||
(...args) => dispatch(participantRoleChanged(...args)));
|
(...args) => dispatch(participantRoleChanged(...args)));
|
||||||
|
|
|
@ -123,7 +123,19 @@ export function localParticipantLeft() {
|
||||||
const participant = getLocalParticipant(getState);
|
const participant = getLocalParticipant(getState);
|
||||||
|
|
||||||
if (participant) {
|
if (participant) {
|
||||||
return dispatch(participantLeft(participant.id));
|
return (
|
||||||
|
dispatch(
|
||||||
|
participantLeft(
|
||||||
|
participant.id,
|
||||||
|
|
||||||
|
// XXX Only the local participant is allowed to leave
|
||||||
|
// without stating the JitsiConference instance because
|
||||||
|
// the local participant is uniquely identified by the
|
||||||
|
// very fact that there is only one local participant
|
||||||
|
// (and the fact that the local participant "joins" at
|
||||||
|
// the beginning of the app and "leaves" at the end of
|
||||||
|
// the app).
|
||||||
|
undefined)));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -234,17 +246,23 @@ export function participantJoined(participant) {
|
||||||
* Action to signal that a participant has left.
|
* Action to signal that a participant has left.
|
||||||
*
|
*
|
||||||
* @param {string} id - Participant's ID.
|
* @param {string} id - Participant's ID.
|
||||||
|
* @param {JitsiConference} conference - The {@code JitsiConference} associated
|
||||||
|
* with the participant identified by the specified {@code id}. Only the local
|
||||||
|
* participant is allowed to not specify an associated {@code JitsiConference}
|
||||||
|
* instance.
|
||||||
* @returns {{
|
* @returns {{
|
||||||
* type: PARTICIPANT_LEFT,
|
* type: PARTICIPANT_LEFT,
|
||||||
* participant: {
|
* participant: {
|
||||||
|
* conference: JitsiConference,
|
||||||
* id: string
|
* id: string
|
||||||
* }
|
* }
|
||||||
* }}
|
* }}
|
||||||
*/
|
*/
|
||||||
export function participantLeft(id) {
|
export function participantLeft(id, conference) {
|
||||||
return {
|
return {
|
||||||
type: PARTICIPANT_LEFT,
|
type: PARTICIPANT_LEFT,
|
||||||
participant: {
|
participant: {
|
||||||
|
conference,
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -61,8 +61,20 @@ ReducerRegistry.register('features/base/participants', (state = [], action) => {
|
||||||
case PARTICIPANT_JOINED:
|
case PARTICIPANT_JOINED:
|
||||||
return [ ...state, _participantJoined(action) ];
|
return [ ...state, _participantJoined(action) ];
|
||||||
|
|
||||||
case PARTICIPANT_LEFT:
|
case PARTICIPANT_LEFT: {
|
||||||
return state.filter(p => p.id !== action.participant.id);
|
// XXX A remote participant is uniquely identified by their id in a
|
||||||
|
// specific JitsiConference instance. The local participant is uniquely
|
||||||
|
// identified by the very fact that there is only one local participant
|
||||||
|
// (and the fact that the local participant "joins" at the beginning of
|
||||||
|
// the app and "leaves" at the end of the app).
|
||||||
|
const { conference, id } = action.participant;
|
||||||
|
|
||||||
|
return state.filter(p =>
|
||||||
|
!(
|
||||||
|
p.id === id
|
||||||
|
&& (p.local
|
||||||
|
|| (conference && p.conference === conference))));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return state;
|
return state;
|
||||||
|
|
Loading…
Reference in New Issue