From c6f3b1fbbe0834ffaffa5130bc6d03b96d5a20df Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Fri, 4 Jun 2021 16:42:39 +0530 Subject: [PATCH] Do not use private props from room summary Signed-off-by: RMidhunSuresh --- src/domain/session/rightpanel/RoomInfoViewModel.js | 9 ++++----- src/matrix/room/BaseRoom.js | 8 ++++++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/domain/session/rightpanel/RoomInfoViewModel.js b/src/domain/session/rightpanel/RoomInfoViewModel.js index 4525838c..d45c4994 100644 --- a/src/domain/session/rightpanel/RoomInfoViewModel.js +++ b/src/domain/session/rightpanel/RoomInfoViewModel.js @@ -5,7 +5,6 @@ export class RoomInfoViewModel extends ViewModel { constructor(options) { super(options); this._room = options.room; - this._roomSummary = this._room._summary._data; } get roomId() { @@ -13,19 +12,19 @@ export class RoomInfoViewModel extends ViewModel { } get canonicalAlias() { - return this._roomSummary.canonicalAlias; + return this._room.canonicalAlias; } get name() { - return this._roomSummary.name || this._room._heroes?._roomName || this._roomSummary.canonicalAlias; + return this._room.name; } get isEncrypted() { - return !!this._roomSummary.encryption; + return !!this._room.isEncrypted; } get memberCount() { - return this._roomSummary.joinCount; + return this._room.joinedMemberCount; } get avatarLetter() { diff --git a/src/matrix/room/BaseRoom.js b/src/matrix/room/BaseRoom.js index 531f6a1a..a6a59278 100644 --- a/src/matrix/room/BaseRoom.js +++ b/src/matrix/room/BaseRoom.js @@ -354,6 +354,14 @@ export class BaseRoom extends EventEmitter { return this.membership === "leave"; } + get canonicalAlias() { + return this._summary.data.canonicalAlias; + } + + get joinedMemberCount() { + return this._summary.data.joinCount; + } + get mediaRepository() { return this._mediaRepository; }