mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
use the same check when seeing if either does not have a timestamp
This commit is contained in:
parent
41a7448c74
commit
4b682ad930
@ -82,8 +82,10 @@ export class RoomTileViewModel extends ViewModel {
|
|||||||
}
|
}
|
||||||
const myTimestamp = myRoom.lastMessageTimestamp;
|
const myTimestamp = myRoom.lastMessageTimestamp;
|
||||||
const theirTimestamp = theirRoom.lastMessageTimestamp;
|
const theirTimestamp = theirRoom.lastMessageTimestamp;
|
||||||
// rooms with a timestamp come before rooms without one
|
const myTimestampValid = Number.isSafeInteger(myTimestamp);
|
||||||
if ((myTimestamp === null) !== (theirTimestamp === null)) {
|
const theirTimestampValid = Number.isSafeInteger(theirTimestamp);
|
||||||
|
// if either does not have a timestamp, put the one with a timestamp first
|
||||||
|
if (myTimestampValid !== theirTimestampValid) {
|
||||||
log("checking if either does not have lastMessageTimestamp ...");
|
log("checking if either does not have lastMessageTimestamp ...");
|
||||||
if (theirTimestamp === null) {
|
if (theirTimestamp === null) {
|
||||||
return logResult(-1);
|
return logResult(-1);
|
||||||
@ -91,7 +93,7 @@ export class RoomTileViewModel extends ViewModel {
|
|||||||
return logResult(1);
|
return logResult(1);
|
||||||
}
|
}
|
||||||
const timeDiff = theirTimestamp - myTimestamp;
|
const timeDiff = theirTimestamp - myTimestamp;
|
||||||
if (timeDiff === 0 || !Number.isSafeInteger(theirTimestamp) || !Number.isSafeInteger(myTimestamp)) {
|
if (timeDiff === 0 || !theirTimestampValid || !myTimestampValid) {
|
||||||
log("checking name ...");
|
log("checking name ...");
|
||||||
// sort alphabetically
|
// sort alphabetically
|
||||||
const nameCmp = this.name.localeCompare(other.name);
|
const nameCmp = this.name.localeCompare(other.name);
|
||||||
|
Loading…
Reference in New Issue
Block a user