mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
fix room list sorting not keeping sorting position after clearing unread
This commit is contained in:
parent
93c08c16c1
commit
402a5e5d54
@ -25,9 +25,6 @@ export class BaseTileViewModel extends ViewModel {
|
|||||||
super(options);
|
super(options);
|
||||||
this._isOpen = false;
|
this._isOpen = false;
|
||||||
this._hidden = false;
|
this._hidden = false;
|
||||||
if (options.isOpen) {
|
|
||||||
this.open();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get hidden() {
|
get hidden() {
|
||||||
@ -52,7 +49,9 @@ export class BaseTileViewModel extends ViewModel {
|
|||||||
if (!this._isOpen) {
|
if (!this._isOpen) {
|
||||||
this._isOpen = true;
|
this._isOpen = true;
|
||||||
this.emitChange("isOpen");
|
this.emitChange("isOpen");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
get isOpen() {
|
get isOpen() {
|
||||||
|
@ -37,14 +37,15 @@ export class LeftPanelViewModel extends ViewModel {
|
|||||||
_mapTileViewModels(rooms, invites) {
|
_mapTileViewModels(rooms, invites) {
|
||||||
// join is not commutative, invites will take precedence over rooms
|
// join is not commutative, invites will take precedence over rooms
|
||||||
return invites.join(rooms).mapValues((roomOrInvite, emitChange) => {
|
return invites.join(rooms).mapValues((roomOrInvite, emitChange) => {
|
||||||
const isOpen = this.navigation.path.get("room")?.value === roomOrInvite.id;
|
|
||||||
let vm;
|
let vm;
|
||||||
if (roomOrInvite.isInvite) {
|
if (roomOrInvite.isInvite) {
|
||||||
vm = new InviteTileViewModel(this.childOptions({isOpen, invite: roomOrInvite, emitChange}));
|
vm = new InviteTileViewModel(this.childOptions({invite: roomOrInvite, emitChange}));
|
||||||
} else {
|
} 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) {
|
if (isOpen) {
|
||||||
|
vm.open();
|
||||||
this._updateCurrentVM(vm);
|
this._updateCurrentVM(vm);
|
||||||
}
|
}
|
||||||
return vm;
|
return vm;
|
||||||
|
@ -105,4 +105,10 @@ export class RoomTileViewModel extends BaseTileViewModel {
|
|||||||
get _avatarSource() {
|
get _avatarSource() {
|
||||||
return this._room;
|
return this._room;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open() {
|
||||||
|
if (super.open()) {
|
||||||
|
this._wasUnreadWhenOpening = this._room.isUnread;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user