mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2025-01-10 20:17:32 +01:00
take null timestamps into account
This commit is contained in:
parent
4969009b2b
commit
00e20d2088
@ -62,8 +62,16 @@ export class RoomTileViewModel extends ViewModel {
|
|||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
const myTimestamp = myRoom.lastMessageTimestamp;
|
||||||
const timeDiff = theirRoom.lastMessageTimestamp - myRoom.lastMessageTimestamp;
|
const theirTimestamp = theirRoom.lastMessageTimestamp;
|
||||||
|
// rooms with a timestamp come before rooms without one
|
||||||
|
if ((myTimestamp === null) !== (theirTimestamp === null)) {
|
||||||
|
if (theirTimestamp === null) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
const timeDiff = theirTimestamp - myTimestamp;
|
||||||
if (timeDiff === 0) {
|
if (timeDiff === 0) {
|
||||||
// sort alphabetically
|
// sort alphabetically
|
||||||
const nameCmp = this._room.name.localeCompare(other._room.name);
|
const nameCmp = this._room.name.localeCompare(other._room.name);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user