From f8d2124aa3429c98d616e5eb6c8460891c1e0ffa Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 26 May 2020 13:33:47 +0100 Subject: [PATCH] MemberAvatar should not have its own letter fallback, it should use BaseAvatar's Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/Avatar.js | 1 + src/components/views/avatars/MemberAvatar.js | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Avatar.js b/src/Avatar.js index 8393ce02b2..2cb90eaea6 100644 --- a/src/Avatar.js +++ b/src/Avatar.js @@ -19,6 +19,7 @@ import {MatrixClientPeg} from './MatrixClientPeg'; import DMRoomMap from './utils/DMRoomMap'; import {getHttpUriForMxc} from "matrix-js-sdk/src/content-repo"; +// Not to be used for BaseAvatar urls as that has similar default avatar fallback already export function avatarUrlForMember(member, width, height, resizeMethod) { let url; if (member && member.getAvatarUrl) { diff --git a/src/components/views/avatars/MemberAvatar.js b/src/components/views/avatars/MemberAvatar.js index d28d80e62a..b763129dd8 100644 --- a/src/components/views/avatars/MemberAvatar.js +++ b/src/components/views/avatars/MemberAvatar.js @@ -18,10 +18,10 @@ limitations under the License. import React from 'react'; import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; -import * as Avatar from '../../../Avatar'; import * as sdk from "../../../index"; import dis from "../../../dispatcher/dispatcher"; import {Action} from "../../../dispatcher/actions"; +import {MatrixClientPeg} from "../../../MatrixClientPeg"; export default createReactClass({ displayName: 'MemberAvatar', @@ -62,10 +62,14 @@ export default createReactClass({ return { name: props.member.name, title: props.title || props.member.userId, - imageUrl: Avatar.avatarUrlForMember(props.member, - props.width, - props.height, - props.resizeMethod), + imageUrl: props.member.getAvatarUrl( + MatrixClientPeg.get().getHomeserverUrl(), + Math.floor(props.width * window.devicePixelRatio), + Math.floor(props.height * window.devicePixelRatio), + props.resizeMethod, + false, + false, + ), }; } else if (props.fallbackUserId) { return {