From 2ceaebbd1f2572c241e8e49e47d864d4adc54c52 Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Wed, 18 Aug 2021 18:17:37 +0530 Subject: [PATCH] Don't find roomId in getter Signed-off-by: RMidhunSuresh --- src/domain/session/rightpanel/MemberListViewModel.js | 3 ++- src/domain/session/rightpanel/MemberTileViewModel.js | 4 ++-- src/domain/session/rightpanel/RightPanelViewModel.js | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/domain/session/rightpanel/MemberListViewModel.js b/src/domain/session/rightpanel/MemberListViewModel.js index 5b8bb83e..664507ff 100644 --- a/src/domain/session/rightpanel/MemberListViewModel.js +++ b/src/domain/session/rightpanel/MemberListViewModel.js @@ -23,6 +23,7 @@ export class MemberListViewModel extends ViewModel { constructor(options) { super(options); const list = options.members; + this._roomId = options.roomId; const powerLevelsObservable = options.powerLevelsObservable; this.track(powerLevelsObservable.subscribe(() => { /*resort based on new power levels here*/ })); @@ -43,7 +44,7 @@ export class MemberListViewModel extends ViewModel { _mapTileViewModels(members) { const mapper = (member, emitChange) => { const mediaRepository = this.mediaRepository; - const vm = new MemberTileViewModel(this.childOptions({member, emitChange, mediaRepository})); + const vm = new MemberTileViewModel(this.childOptions({member, emitChange, mediaRepository, roomId: this._roomId})); this.nameDisambiguator.disambiguate(vm); return vm; } diff --git a/src/domain/session/rightpanel/MemberTileViewModel.js b/src/domain/session/rightpanel/MemberTileViewModel.js index eac6a6d4..c9e460b2 100644 --- a/src/domain/session/rightpanel/MemberTileViewModel.js +++ b/src/domain/session/rightpanel/MemberTileViewModel.js @@ -24,6 +24,7 @@ export class MemberTileViewModel extends ViewModel { this._mediaRepository = options.mediaRepository this._previousName = null; this._nameChanged = true; + this._roomId = options.roomId; } get name() { @@ -47,8 +48,7 @@ export class MemberTileViewModel extends ViewModel { } get detailsUrl() { - const roomId = this.navigation.path.get("room").value; - return `${this.urlCreator.openRoomActionUrl(roomId)}/member/${this._member.userId}`; + return `${this.urlCreator.openRoomActionUrl(this._roomId)}/member/${this._member.userId}`; } _updatePreviousName(newName) { diff --git a/src/domain/session/rightpanel/RightPanelViewModel.js b/src/domain/session/rightpanel/RightPanelViewModel.js index 670df868..c66f1755 100644 --- a/src/domain/session/rightpanel/RightPanelViewModel.js +++ b/src/domain/session/rightpanel/RightPanelViewModel.js @@ -36,7 +36,7 @@ export class RightPanelViewModel extends ViewModel { } const room = this._room; const powerLevelsObservable = await this._room.observePowerLevels(); - return {members: this._members, powerLevelsObservable, mediaRepository: room.mediaRepository}; + return {members: this._members, powerLevelsObservable, mediaRepository: room.mediaRepository, roomId: this._room.id}; } async _getMemberDetailsArguments() {