MemberAvatar should not have its own letter fallback, it should use BaseAvatar's

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
pull/21833/head
Michael Telatynski 2020-05-26 13:33:47 +01:00
parent 608a1feb03
commit f8d2124aa3
2 changed files with 10 additions and 5 deletions

View File

@ -19,6 +19,7 @@ import {MatrixClientPeg} from './MatrixClientPeg';
import DMRoomMap from './utils/DMRoomMap'; import DMRoomMap from './utils/DMRoomMap';
import {getHttpUriForMxc} from "matrix-js-sdk/src/content-repo"; 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) { export function avatarUrlForMember(member, width, height, resizeMethod) {
let url; let url;
if (member && member.getAvatarUrl) { if (member && member.getAvatarUrl) {

View File

@ -18,10 +18,10 @@ limitations under the License.
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import createReactClass from 'create-react-class'; import createReactClass from 'create-react-class';
import * as Avatar from '../../../Avatar';
import * as sdk from "../../../index"; import * as sdk from "../../../index";
import dis from "../../../dispatcher/dispatcher"; import dis from "../../../dispatcher/dispatcher";
import {Action} from "../../../dispatcher/actions"; import {Action} from "../../../dispatcher/actions";
import {MatrixClientPeg} from "../../../MatrixClientPeg";
export default createReactClass({ export default createReactClass({
displayName: 'MemberAvatar', displayName: 'MemberAvatar',
@ -62,10 +62,14 @@ export default createReactClass({
return { return {
name: props.member.name, name: props.member.name,
title: props.title || props.member.userId, title: props.title || props.member.userId,
imageUrl: Avatar.avatarUrlForMember(props.member, imageUrl: props.member.getAvatarUrl(
props.width, MatrixClientPeg.get().getHomeserverUrl(),
props.height, Math.floor(props.width * window.devicePixelRatio),
props.resizeMethod), Math.floor(props.height * window.devicePixelRatio),
props.resizeMethod,
false,
false,
),
}; };
} else if (props.fallbackUserId) { } else if (props.fallbackUserId) {
return { return {