feat(external-api) add "name" property to participant-kicked-out event

pull/14958/head jitsi-meet_9649
Saúl Ibarra Corretgé 10 months ago committed by Saúl Ibarra Corretgé
parent 6ff7995cee
commit 2483d901d6
  1. 4
      modules/API/API.js
  2. 45
      react/features/external-api/middleware.ts

@ -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}
*/

@ -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;

Loading…
Cancel
Save