Do not use private props from room summary

Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
RMidhunSuresh 2021-06-04 16:42:39 +05:30
parent 4700009c68
commit c6f3b1fbbe
2 changed files with 12 additions and 5 deletions

View file

@ -5,7 +5,6 @@ export class RoomInfoViewModel extends ViewModel {
constructor(options) { constructor(options) {
super(options); super(options);
this._room = options.room; this._room = options.room;
this._roomSummary = this._room._summary._data;
} }
get roomId() { get roomId() {
@ -13,19 +12,19 @@ export class RoomInfoViewModel extends ViewModel {
} }
get canonicalAlias() { get canonicalAlias() {
return this._roomSummary.canonicalAlias; return this._room.canonicalAlias;
} }
get name() { get name() {
return this._roomSummary.name || this._room._heroes?._roomName || this._roomSummary.canonicalAlias; return this._room.name;
} }
get isEncrypted() { get isEncrypted() {
return !!this._roomSummary.encryption; return !!this._room.isEncrypted;
} }
get memberCount() { get memberCount() {
return this._roomSummary.joinCount; return this._room.joinedMemberCount;
} }
get avatarLetter() { get avatarLetter() {

View file

@ -354,6 +354,14 @@ export class BaseRoom extends EventEmitter {
return this.membership === "leave"; return this.membership === "leave";
} }
get canonicalAlias() {
return this._summary.data.canonicalAlias;
}
get joinedMemberCount() {
return this._summary.data.joinCount;
}
get mediaRepository() { get mediaRepository() {
return this._mediaRepository; return this._mediaRepository;
} }