diff --git a/src/preview/PreviewViewModel.js b/src/preview/PreviewViewModel.js index d025782..5c340eb 100644 --- a/src/preview/PreviewViewModel.js +++ b/src/preview/PreviewViewModel.js @@ -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; } }