From bcca4d4bcc5c6c147e6aaedb877806866329856e Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Fri, 1 Sep 2023 14:25:48 -0400 Subject: [PATCH] Adds idHex to the date sorting in replies and comments to make sure the order is correct when 2 posts are placed within the same second. --- .../main/java/com/vitorpamplona/amethyst/model/Note.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/model/Note.kt b/app/src/main/java/com/vitorpamplona/amethyst/model/Note.kt index ad0daf0fe..b87d61592 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/model/Note.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/model/Note.kt @@ -151,7 +151,7 @@ open class Note(val idHex: String) { val replyTo = replyTo if (event is RepostEvent || event is GenericRepostEvent || replyTo == null || replyTo.isEmpty()) { return LevelSignature( - signature = "/" + formattedDateTime(createdAt() ?: 0) + ";", + signature = "/" + formattedDateTime(createdAt() ?: 0) + idHex.substring(0, 8) + ";", createdAt = createdAt(), author = author ) @@ -176,13 +176,13 @@ open class Note(val idHex: String) { val threadOrder = if (parent?.author == author && createdAt() != null) { // author of the thread first, in **ascending** order - "9" + formattedDateTime((parent?.createdAt ?: 0) + (now - (createdAt() ?: 0))) + "9" + formattedDateTime((parent?.createdAt ?: 0) + (now - (createdAt() ?: 0))) + idHex.substring(0, 8) } else if (author?.pubkeyHex == account.pubkeyHex) { - "8" + formattedDateTime(createdAt() ?: 0) // my replies + "8" + formattedDateTime(createdAt() ?: 0) + idHex.substring(0, 8) // my replies } else if (author?.pubkeyHex in accountFollowingSet) { - "7" + formattedDateTime(createdAt() ?: 0) // my follows replies. + "7" + formattedDateTime(createdAt() ?: 0) + idHex.substring(0, 8) // my follows replies. } else { - "0" + formattedDateTime(createdAt() ?: 0) // everyone else. + "0" + formattedDateTime(createdAt() ?: 0) + idHex.substring(0, 8) // everyone else. } val mySignature = LevelSignature(