Skip to content

Commit

Permalink
fix(iframeAPI): Fix role changed event to work not only for local user.
Browse files Browse the repository at this point in the history
  • Loading branch information
damencho committed Nov 22, 2024
1 parent e151be4 commit 97310b5
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions react/features/base/participants/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
PARTICIPANT_JOINED,
PARTICIPANT_KICKED,
PARTICIPANT_LEFT,
PARTICIPANT_ROLE_CHANGED,
PARTICIPANT_SOURCES_UPDATED,
PARTICIPANT_UPDATED,
PIN_PARTICIPANT,
Expand Down Expand Up @@ -389,19 +390,27 @@ export function participantPresenceChanged(id: string, presence: string) {
*
* @param {string} id - Participant's ID.
* @param {PARTICIPANT_ROLE} role - Participant's new role.
* @returns {{
* type: PARTICIPANT_UPDATED,
* participant: {
* id: string,
* role: PARTICIPANT_ROLE
* }
* }}
* @returns {Promise}
*/
export function participantRoleChanged(id: string, role: string) {
return participantUpdated({
id,
role
});
return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
const oldParticipantRole = getParticipantById(getState(), id)?.role;

dispatch(participantUpdated({
id,
role
}));

if (oldParticipantRole !== role) {
dispatch({
type: PARTICIPANT_ROLE_CHANGED,
participant: {
id,
role
}
});
}
};
}

/**
Expand Down

0 comments on commit 97310b5

Please sign in to comment.