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() { get avatarUrl() {
if (this._avatarSource.avatarUrl) { if (this._avatarSource.avatarUrl) {
const size = 32 * this.platform.devicePixelRatio; 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; return null;
} }

View file

@ -412,6 +412,7 @@ export class Session {
hsApi: this._hsApi, hsApi: this._hsApi,
emitCollectionRemove: this._inviteRemoveCallback, emitCollectionRemove: this._inviteRemoveCallback,
emitCollectionUpdate: this._inviteUpdateCallback, emitCollectionUpdate: this._inviteUpdateCallback,
mediaRepository: this._mediaRepository,
user: this._user, user: this._user,
platform: this._platform, 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"; import {MemberChange, RoomMember, EVENT_TYPE as MEMBER_EVENT_TYPE} from "./members/RoomMember.js";
export class Invite extends EventEmitter { export class Invite extends EventEmitter {
constructor({roomId, user, hsApi, emitCollectionRemove, emitCollectionUpdate, platform}) { constructor({roomId, user, hsApi, mediaRepository, emitCollectionRemove, emitCollectionUpdate, platform}) {
super(); super();
this._roomId = roomId; this._roomId = roomId;
this._user = user; this._user = user;
this._hsApi = hsApi; this._hsApi = hsApi;
this._emitCollectionRemove = emitCollectionRemove; this._emitCollectionRemove = emitCollectionRemove;
this._emitCollectionUpdate = emitCollectionUpdate; this._emitCollectionUpdate = emitCollectionUpdate;
this._mediaRepository = mediaRepository;
this._platform = platform; this._platform = platform;
this._inviteData = null; this._inviteData = null;
this._accepting = false; this._accepting = false;
@ -103,6 +104,10 @@ export class Invite extends EventEmitter {
return this._rejected; return this._rejected;
} }
get mediaRepository() {
return this._mediaRepository;
}
_emitChange(params) { _emitChange(params) {
this.emit("change"); this.emit("change");
this._emitCollectionUpdate(this, params); this._emitCollectionUpdate(this, params);