From a8d4ee0dd6881310e6835c8b3928925dd85adc06 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Fri, 7 May 2021 13:11:17 +0200 Subject: [PATCH] different room view models don't need to initiate switching now as this is triggered by observing the room status --- src/domain/session/room/InviteViewModel.js | 15 ++------------- src/domain/session/room/RoomViewModel.js | 11 ++--------- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/src/domain/session/room/InviteViewModel.js b/src/domain/session/room/InviteViewModel.js index 15fcb5a5..a9cc917f 100644 --- a/src/domain/session/room/InviteViewModel.js +++ b/src/domain/session/room/InviteViewModel.js @@ -21,10 +21,9 @@ import {ViewModel} from "../../ViewModel.js"; export class InviteViewModel extends ViewModel { constructor(options) { super(options); - const {invite, mediaRepository, refreshRoomViewModel} = options; + const {invite, mediaRepository} = options; this._invite = invite; this._mediaRepository = mediaRepository; - this._refreshRoomViewModel = refreshRoomViewModel; this._onInviteChange = this._onInviteChange.bind(this); this._error = null; this._closeUrl = this.urlCreator.urlUntilSegment("session"); @@ -107,17 +106,7 @@ export class InviteViewModel extends ViewModel { } _onInviteChange() { - if (this._invite.accepted || this._invite.rejected) { - // close invite if rejected, or open room if accepted. - // Done with a callback rather than manipulating the nav, - // as closing the invite changes the nav path depending whether - // we're in a grid view, and opening the room doesn't change - // the nav path because the url is the same for an - // invite and the room. - this._refreshRoomViewModel(this.id); - } else { - this.emitChange(); - } + this.emitChange(); } dispose() { diff --git a/src/domain/session/room/RoomViewModel.js b/src/domain/session/room/RoomViewModel.js index 63aa6811..df631b87 100644 --- a/src/domain/session/room/RoomViewModel.js +++ b/src/domain/session/room/RoomViewModel.js @@ -22,10 +22,9 @@ import {ViewModel} from "../../ViewModel.js"; export class RoomViewModel extends ViewModel { constructor(options) { super(options); - const {room, ownUserId, refreshRoomViewModel} = options; + const {room, ownUserId} = options; this._room = room; this._ownUserId = ownUserId; - this._refreshRoomViewModel = refreshRoomViewModel; this._timelineVM = null; this._onRoomChange = this._onRoomChange.bind(this); this._timelineError = null; @@ -86,13 +85,7 @@ export class RoomViewModel extends ViewModel { // room doesn't tell us yet which fields changed, // so emit all fields originating from summary _onRoomChange() { - // if there is now an invite on this (left) room, - // show the invite view by refreshing the view model - if (this._room.invite) { - this._refreshRoomViewModel(this.id); - } else { - this.emitChange("name"); - } + this.emitChange(); } get kind() { return "room"; }