From aaf4e79a73b1797f252207cb0b2c8c19d95db866 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 27 Apr 2021 11:01:33 +0200 Subject: [PATCH] make media repo available on invite --- src/domain/session/leftpanel/BaseTileViewModel.js | 2 +- src/matrix/Session.js | 1 + src/matrix/room/Invite.js | 7 ++++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/domain/session/leftpanel/BaseTileViewModel.js b/src/domain/session/leftpanel/BaseTileViewModel.js index 6e074caa..d4ca3293 100644 --- a/src/domain/session/leftpanel/BaseTileViewModel.js +++ b/src/domain/session/leftpanel/BaseTileViewModel.js @@ -78,7 +78,7 @@ export class BaseTileViewModel extends ViewModel { get avatarUrl() { if (this._avatarSource.avatarUrl) { const size = 32 * this.platform.devicePixelRatio; - return this._room.mediaRepository.mxcUrlThumbnail(this._avatarSource.avatarUrl, size, size, "crop"); + return this._avatarSource.mediaRepository.mxcUrlThumbnail(this._avatarSource.avatarUrl, size, size, "crop"); } return null; } diff --git a/src/matrix/Session.js b/src/matrix/Session.js index 99ed5035..a9076169 100644 --- a/src/matrix/Session.js +++ b/src/matrix/Session.js @@ -412,6 +412,7 @@ export class Session { hsApi: this._hsApi, emitCollectionRemove: this._inviteRemoveCallback, emitCollectionUpdate: this._inviteUpdateCallback, + mediaRepository: this._mediaRepository, user: this._user, platform: this._platform, }); diff --git a/src/matrix/room/Invite.js b/src/matrix/room/Invite.js index 1c8f1bcc..4ce74ea8 100644 --- a/src/matrix/room/Invite.js +++ b/src/matrix/room/Invite.js @@ -20,13 +20,14 @@ import {Heroes} from "./members/Heroes.js"; import {MemberChange, RoomMember, EVENT_TYPE as MEMBER_EVENT_TYPE} from "./members/RoomMember.js"; export class Invite extends EventEmitter { - constructor({roomId, user, hsApi, emitCollectionRemove, emitCollectionUpdate, platform}) { + constructor({roomId, user, hsApi, mediaRepository, emitCollectionRemove, emitCollectionUpdate, platform}) { super(); this._roomId = roomId; this._user = user; this._hsApi = hsApi; this._emitCollectionRemove = emitCollectionRemove; this._emitCollectionUpdate = emitCollectionUpdate; + this._mediaRepository = mediaRepository; this._platform = platform; this._inviteData = null; this._accepting = false; @@ -103,6 +104,10 @@ export class Invite extends EventEmitter { return this._rejected; } + get mediaRepository() { + return this._mediaRepository; + } + _emitChange(params) { this.emit("change"); this._emitCollectionUpdate(this, params);