forked from mystiq/hydrogen-web
use the same check when seeing if either does not have a timestamp
This commit is contained in:
parent
41a7448c74
commit
4b682ad930
1 changed files with 5 additions and 3 deletions
|
@ -82,8 +82,10 @@ export class RoomTileViewModel extends ViewModel {
|
|||
}
|
||||
const myTimestamp = myRoom.lastMessageTimestamp;
|
||||
const theirTimestamp = theirRoom.lastMessageTimestamp;
|
||||
// rooms with a timestamp come before rooms without one
|
||||
if ((myTimestamp === null) !== (theirTimestamp === null)) {
|
||||
const myTimestampValid = Number.isSafeInteger(myTimestamp);
|
||||
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 ...");
|
||||
if (theirTimestamp === null) {
|
||||
return logResult(-1);
|
||||
|
@ -91,7 +93,7 @@ export class RoomTileViewModel extends ViewModel {
|
|||
return logResult(1);
|
||||
}
|
||||
const timeDiff = theirTimestamp - myTimestamp;
|
||||
if (timeDiff === 0 || !Number.isSafeInteger(theirTimestamp) || !Number.isSafeInteger(myTimestamp)) {
|
||||
if (timeDiff === 0 || !theirTimestampValid || !myTimestampValid) {
|
||||
log("checking name ...");
|
||||
// sort alphabetically
|
||||
const nameCmp = this.name.localeCompare(other.name);
|
||||
|
|
Loading…
Reference in a new issue