make media repo available on invite

This commit is contained in:
Bruno Windels 2021-04-27 11:01:33 +02:00
parent 9b9e6fceda
commit aaf4e79a73
3 changed files with 8 additions and 2 deletions

View File

@ -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;
}

View File

@ -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,
});

View File

@ -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);