Don't move read rooms to lower sorting position

This commit is contained in:
Bruno Windels 2021-05-12 18:28:39 +02:00
parent 402a5e5d54
commit 86d60496c0

View file

@ -17,16 +17,11 @@ limitations under the License.
import {BaseTileViewModel} from "./BaseTileViewModel.js"; import {BaseTileViewModel} from "./BaseTileViewModel.js";
function isSortedAsUnread(vm) {
return vm.isUnread || (vm.isOpen && vm._wasUnreadWhenOpening);
}
export class RoomTileViewModel extends BaseTileViewModel { export class RoomTileViewModel extends BaseTileViewModel {
constructor(options) { constructor(options) {
super(options); super(options);
const {room} = options; const {room} = options;
this._room = room; this._room = room;
this._wasUnreadWhenOpening = false;
this._url = this.urlCreator.openRoomActionUrl(this._room.id); this._url = this.urlCreator.openRoomActionUrl(this._room.id);
} }
@ -57,12 +52,6 @@ export class RoomTileViewModel extends BaseTileViewModel {
} }
return -1; return -1;
} }
if (isSortedAsUnread(this) !== isSortedAsUnread(other)) {
if (isSortedAsUnread(this)) {
return -1;
}
return 1;
}
const myTimestamp = myRoom.lastMessageTimestamp; const myTimestamp = myRoom.lastMessageTimestamp;
const theirTimestamp = theirRoom.lastMessageTimestamp; const theirTimestamp = theirRoom.lastMessageTimestamp;
const myTimestampValid = Number.isSafeInteger(myTimestamp); const myTimestampValid = Number.isSafeInteger(myTimestamp);
@ -105,10 +94,4 @@ export class RoomTileViewModel extends BaseTileViewModel {
get _avatarSource() { get _avatarSource() {
return this._room; return this._room;
} }
open() {
if (super.open()) {
this._wasUnreadWhenOpening = this._room.isUnread;
}
}
} }