always show default avatar if none available
This commit is contained in:
parent
f42820e4ba
commit
7b5796ce03
@ -20,6 +20,8 @@ import {resolveServer} from "./HomeServer.js";
|
||||
import {ClientListViewModel} from "../open/ClientListViewModel.js";
|
||||
import {ClientViewModel} from "../open/ClientViewModel.js";
|
||||
|
||||
const DEFAULT_AVATAR = "images/chat-icon.svg";
|
||||
|
||||
export class PreviewViewModel extends ViewModel {
|
||||
constructor(options) {
|
||||
super(options);
|
||||
@ -82,7 +84,7 @@ export class PreviewViewModel extends ViewModel {
|
||||
this.name = profile.displayname || userId;
|
||||
this.avatarUrl = profile.avatar_url ?
|
||||
homeserver.mxcUrlThumbnail(profile.avatar_url, 64, 64, "crop") :
|
||||
null;
|
||||
DEFAULT_AVATAR;
|
||||
this.identifier = userId;
|
||||
}
|
||||
|
||||
@ -99,7 +101,7 @@ export class PreviewViewModel extends ViewModel {
|
||||
this.name = publicRoom?.name || publicRoom?.canonical_alias || link.identifier;
|
||||
this.avatarUrl = publicRoom?.avatar_url ?
|
||||
homeserver.mxcUrlThumbnail(publicRoom.avatar_url, 64, 64, "crop") :
|
||||
null;
|
||||
DEFAULT_AVATAR;
|
||||
this.memberCount = publicRoom?.num_joined_members;
|
||||
this.topic = publicRoom?.topic;
|
||||
this.identifier = publicRoom?.canonical_alias || link.identifier;
|
||||
@ -111,6 +113,6 @@ export class PreviewViewModel extends ViewModel {
|
||||
_setNoPreview(link) {
|
||||
this.name = link.identifier;
|
||||
this.identifier = null;
|
||||
this.avatarUrl = "images/chat-icon.svg";
|
||||
this.avatarUrl = DEFAULT_AVATAR;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user