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