Don't find roomId in getter

Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
RMidhunSuresh 2021-08-18 18:17:37 +05:30
parent 7e177f6953
commit 2ceaebbd1f
3 changed files with 5 additions and 4 deletions

View file

@ -23,6 +23,7 @@ export class MemberListViewModel extends ViewModel {
constructor(options) { constructor(options) {
super(options); super(options);
const list = options.members; const list = options.members;
this._roomId = options.roomId;
const powerLevelsObservable = options.powerLevelsObservable; const powerLevelsObservable = options.powerLevelsObservable;
this.track(powerLevelsObservable.subscribe(() => { /*resort based on new power levels here*/ })); this.track(powerLevelsObservable.subscribe(() => { /*resort based on new power levels here*/ }));
@ -43,7 +44,7 @@ export class MemberListViewModel extends ViewModel {
_mapTileViewModels(members) { _mapTileViewModels(members) {
const mapper = (member, emitChange) => { const mapper = (member, emitChange) => {
const mediaRepository = this.mediaRepository; 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); this.nameDisambiguator.disambiguate(vm);
return vm; return vm;
} }

View file

@ -24,6 +24,7 @@ export class MemberTileViewModel extends ViewModel {
this._mediaRepository = options.mediaRepository this._mediaRepository = options.mediaRepository
this._previousName = null; this._previousName = null;
this._nameChanged = true; this._nameChanged = true;
this._roomId = options.roomId;
} }
get name() { get name() {
@ -47,8 +48,7 @@ export class MemberTileViewModel extends ViewModel {
} }
get detailsUrl() { get detailsUrl() {
const roomId = this.navigation.path.get("room").value; return `${this.urlCreator.openRoomActionUrl(this._roomId)}/member/${this._member.userId}`;
return `${this.urlCreator.openRoomActionUrl(roomId)}/member/${this._member.userId}`;
} }
_updatePreviousName(newName) { _updatePreviousName(newName) {

View file

@ -36,7 +36,7 @@ export class RightPanelViewModel extends ViewModel {
} }
const room = this._room; const room = this._room;
const powerLevelsObservable = await this._room.observePowerLevels(); 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() { async _getMemberDetailsArguments() {