Save users' avatars

This commit is contained in:
Jaiwanth 2021-05-31 22:27:29 +05:30
parent fa073cd958
commit 28a1a551fe
4 changed files with 35 additions and 7 deletions

View file

@ -36,6 +36,7 @@ interface IProps extends Omit<React.ComponentProps<typeof BaseAvatar>, "name" |
// Whether the onClick of the avatar should be overriden to dispatch `Action.ViewUser`
viewUserOnClick?: boolean;
title?: string;
avatarSrc?: string;
}
interface IState {
@ -66,7 +67,8 @@ export default class MemberAvatar extends React.Component<IProps, IState> {
private static getState(props: IProps): IState {
if (props.member?.name) {
let imageUrl = null;
if (props.member.getMxcAvatarUrl()) {
if (props.avatarSrc) imageUrl = props.avatarSrc;
else if (props.member.getMxcAvatarUrl()) {
imageUrl = mediaFromMxc(props.member.getMxcAvatarUrl()).getThumbnailOfSourceHttp(
props.width,
props.height,