fix(avatar): Prefer avatar url from jwt identity.

pull/15085/head jitsi-meet_9710
damencho 9 months ago committed by Дамян Минков
parent ad6e675b18
commit d755b9decb
  1. 18
      conference.js
  2. 4
      modules/API/API.js
  3. 19
      react/features/base/conference/actions.any.ts
  4. 2
      react/features/base/conference/functions.ts

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

@ -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);
},

@ -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({

@ -90,7 +90,9 @@ export function commonUserJoinedHandling(
} else {
const isReplacing = user?.isReplacing();
// the identity and avatar come from jwt and never change in the presence
dispatch(participantJoined({
avatarURL: user.getIdentity()?.user?.avatar,
botType: user.getBotType(),
conference,
id,

Loading…
Cancel
Save