Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
fix(avatar): Prefer avatar url from jwt identity.
damenchod755b9decbd3
diff --git a/conference.js b/conference.jsindex 197a64a50c..4af2765d6c 100644--- a/conference.js+++ b/conference.js@@ -111,6 +111,7 @@ import {import {getLocalParticipant,getNormalizedDisplayName,+ getParticipantByIdOrUndefined,getVirtualScreenshareParticipantByOwnerId} from './react/features/base/participants/functions';import { updateSettings } from './react/features/base/settings/actions';@@ -1775,12 +1776,17 @@ export default {room.addCommandListener(this.commands.defaults.AVATAR_URL,(data, from) => {- APP.store.dispatch(- participantUpdated({- conference: room,- id: from,- avatarURL: data.value- }));+ const participant = getParticipantByIdOrUndefined(APP.store, from);++ // if already set from presence(jwt), skip the command processing+ if (!participant?.avatarURL) {+ APP.store.dispatch(+ participantUpdated({+ conference: room,+ id: from,+ avatarURL: data.value+ }));+ }});room.on(diff --git a/modules/API/API.js b/modules/API/API.jsindex d4887e3d7a..10a7c8a1fd 100644--- a/modules/API/API.js+++ b/modules/API/API.js@@ -489,7 +489,9 @@ function initCommands() {sendAnalytics(createApiEvent('email.changed'));APP.conference.changeLocalEmail(email);},- 'avatar-url': avatarUrl => {+ 'avatar-url': avatarUrl => { // @deprecated+ console.warn('Using command avatarUrl is deprecated. Use context.user.avatar in the jwt.');+sendAnalytics(createApiEvent('avatar.url.changed'));APP.conference.changeLocalAvatarUrl(avatarUrl);},diff --git a/react/features/base/conference/actions.any.ts b/react/features/base/conference/actions.any.tsindex 64a00b3979..86da22e2f4 100644--- a/react/features/base/conference/actions.any.ts+++ b/react/features/base/conference/actions.any.ts@@ -25,7 +25,7 @@ import {participantSourcesUpdated,participantUpdated} from '../participants/actions';-import { getNormalizedDisplayName } from '../participants/functions';+import { getNormalizedDisplayName, getParticipantByIdOrUndefined } from '../participants/functions';import { IJitsiParticipant } from '../participants/types';import { toState } from '../redux/functions';import {@@ -277,11 +277,18 @@ function _addConferenceListeners(conference: IJitsiConference, dispatch: IStore[conference.addCommandListener(AVATAR_URL_COMMAND,- (data: { value: string; }, id: string) => dispatch(participantUpdated({- conference,- id,- avatarURL: data.value- })));+ (data: { value: string; }, id: string) => {+ const participant = getParticipantByIdOrUndefined(state, id);++ // if already set from presence(jwt), skip the command processing+ if (!participant?.avatarURL) {+ return dispatch(participantUpdated({+ conference,+ id,+ avatarURL: data.value+ }));+ }+ });conference.addCommandListener(EMAIL_COMMAND,(data: { value: string; }, id: string) => dispatch(participantUpdated({diff --git a/react/features/base/conference/functions.ts b/react/features/base/conference/functions.tsindex f08224d118..14d86e2815 100644--- a/react/features/base/conference/functions.ts+++ b/react/features/base/conference/functions.ts@@ -90,7 +90,9 @@ export function commonUserJoinedHandling(} else {const isReplacing = user?.isReplacing();+ // the identity and avatar come from jwt and never change in the presencedispatch(participantJoined({+ avatarURL: user.getIdentity()?.user?.avatar,botType: user.getBotType(),conference,id,