diff --git a/modules/API/API.js b/modules/API/API.js index 4fdf43fd50..d7c71abd9c 100644 --- a/modules/API/API.js +++ b/modules/API/API.js @@ -1819,9 +1819,9 @@ class API { * Notify external application of a participant, remote or local, being * removed from the conference by another participant. * - * @param {string} kicked - The ID of the participant removed from the + * @param {Object} kicked - The participant removed from the * conference. - * @param {string} kicker - The ID of the participant that removed the + * @param {Object} kicker - The participant that removed the * other participant. * @returns {void} */ diff --git a/react/features/external-api/middleware.ts b/react/features/external-api/middleware.ts index c058a286d2..cb51821640 100644 --- a/react/features/external-api/middleware.ts +++ b/react/features/external-api/middleware.ts @@ -21,7 +21,8 @@ import { import { getDominantSpeakerParticipant, getLocalParticipant, - getParticipantById + getParticipantById, + getParticipantDisplayName } from '../base/participants/functions'; import MiddlewareRegistry from '../base/redux/MiddlewareRegistry'; import { getBaseUrl } from '../base/util/helpers'; @@ -133,15 +134,29 @@ MiddlewareRegistry.register(store => next => action => { APP.API.notifyDataChannelOpened(); break; - case KICKED_OUT: + case KICKED_OUT: { + const state = store.getState(); + const localParticipant = getLocalParticipant(state); + + if (!localParticipant) { + break; + } + + const pId = action.participant.getId(); + APP.API.notifyKickedOut( { - id: getLocalParticipant(store.getState())?.id, + id: localParticipant.id, + name: getParticipantDisplayName(state, localParticipant.id), local: true }, - { id: action.participant ? action.participant.getId() : undefined } + { + id: pId, + name: getParticipantDisplayName(state, pId) + } ); break; + } case NOTIFY_CAMERA_ERROR: if (action.error) { @@ -156,14 +171,28 @@ MiddlewareRegistry.register(store => next => action => { } break; - case PARTICIPANT_KICKED: + case PARTICIPANT_KICKED: { + const state = store.getState(); + const kickedParticipant = getParticipantById(state, action.kicked); + const kickerParticipant = getParticipantById(state, action.kicker); + + if (!kickerParticipant || !kickedParticipant) { + break; + } + APP.API.notifyKickedOut( { - id: action.kicked, - local: false + id: kickedParticipant.id, + local: kickedParticipant.local, + name: getParticipantDisplayName(state, kickedParticipant.id) }, - { id: action.kicker }); + { + id: kickerParticipant.id, + local: kickerParticipant.local, + name: getParticipantDisplayName(state, kickerParticipant.id) + }); break; + } case PARTICIPANT_LEFT: { const { participant } = action;