diff --git a/src/domain/session/leftpanel/BaseTileViewModel.js b/src/domain/session/leftpanel/BaseTileViewModel.js index 360f2b39..62ea6380 100644 --- a/src/domain/session/leftpanel/BaseTileViewModel.js +++ b/src/domain/session/leftpanel/BaseTileViewModel.js @@ -25,9 +25,6 @@ export class BaseTileViewModel extends ViewModel { super(options); this._isOpen = false; this._hidden = false; - if (options.isOpen) { - this.open(); - } } get hidden() { diff --git a/src/domain/session/leftpanel/LeftPanelViewModel.js b/src/domain/session/leftpanel/LeftPanelViewModel.js index a1a577a9..6503c124 100644 --- a/src/domain/session/leftpanel/LeftPanelViewModel.js +++ b/src/domain/session/leftpanel/LeftPanelViewModel.js @@ -37,14 +37,15 @@ export class LeftPanelViewModel extends ViewModel { _mapTileViewModels(rooms, invites) { // join is not commutative, invites will take precedence over rooms return invites.join(rooms).mapValues((roomOrInvite, emitChange) => { - const isOpen = this.navigation.path.get("room")?.value === roomOrInvite.id; let vm; if (roomOrInvite.isInvite) { - vm = new InviteTileViewModel(this.childOptions({isOpen, invite: roomOrInvite, emitChange})); + vm = new InviteTileViewModel(this.childOptions({invite: roomOrInvite, emitChange})); } else { - vm = new RoomTileViewModel(this.childOptions({isOpen, room: roomOrInvite, emitChange})); + vm = new RoomTileViewModel(this.childOptions({room: roomOrInvite, emitChange})); } + const isOpen = this.navigation.path.get("room")?.value === roomOrInvite.id; if (isOpen) { + vm.open(); this._updateCurrentVM(vm); } return vm; diff --git a/src/domain/session/leftpanel/RoomTileViewModel.js b/src/domain/session/leftpanel/RoomTileViewModel.js index 50164b18..eebea618 100644 --- a/src/domain/session/leftpanel/RoomTileViewModel.js +++ b/src/domain/session/leftpanel/RoomTileViewModel.js @@ -17,16 +17,11 @@ limitations under the License. import {BaseTileViewModel} from "./BaseTileViewModel.js"; -function isSortedAsUnread(vm) { - return vm.isUnread || (vm.isOpen && vm._wasUnreadWhenOpening); -} - export class RoomTileViewModel extends BaseTileViewModel { constructor(options) { super(options); const {room} = options; this._room = room; - this._wasUnreadWhenOpening = false; this._url = this.urlCreator.openRoomActionUrl(this._room.id); } @@ -57,12 +52,6 @@ export class RoomTileViewModel extends BaseTileViewModel { } return -1; } - if (isSortedAsUnread(this) !== isSortedAsUnread(other)) { - if (isSortedAsUnread(this)) { - return -1; - } - return 1; - } const myTimestamp = myRoom.lastMessageTimestamp; const theirTimestamp = theirRoom.lastMessageTimestamp; const myTimestampValid = Number.isSafeInteger(myTimestamp);