kopia lustrzana https://github.com/vitorpamplona/amethyst
Fixes thread ordering issues with two notes with the same idHex
rodzic
d3fa05a4df
commit
d13e8bacec
|
@ -142,7 +142,7 @@ open class Note(val idHex: String) {
|
||||||
* This method caches signatures during each execution to avoid recalculation in longer threads
|
* This method caches signatures during each execution to avoid recalculation in longer threads
|
||||||
*/
|
*/
|
||||||
fun replyLevelSignature(
|
fun replyLevelSignature(
|
||||||
eventsToConsider: Set<Note>,
|
eventsToConsider: Set<HexKey>,
|
||||||
cachedSignatures: MutableMap<Note, LevelSignature>,
|
cachedSignatures: MutableMap<Note, LevelSignature>,
|
||||||
account: User,
|
account: User,
|
||||||
accountFollowingSet: Set<String>,
|
accountFollowingSet: Set<String>,
|
||||||
|
@ -159,7 +159,7 @@ open class Note(val idHex: String) {
|
||||||
|
|
||||||
val parent = (
|
val parent = (
|
||||||
replyTo
|
replyTo
|
||||||
.filter { it in eventsToConsider } // This forces the signature to be based on a branch, avoiding two roots
|
.filter { it.idHex in eventsToConsider } // This forces the signature to be based on a branch, avoiding two roots
|
||||||
.map {
|
.map {
|
||||||
cachedSignatures[it] ?: it.replyLevelSignature(
|
cachedSignatures[it] ?: it.replyLevelSignature(
|
||||||
eventsToConsider,
|
eventsToConsider,
|
||||||
|
|
|
@ -18,11 +18,12 @@ class ThreadFeedFilter(val account: Account, val noteId: String) : FeedFilter<No
|
||||||
val cachedSignatures: MutableMap<Note, Note.LevelSignature> = mutableMapOf()
|
val cachedSignatures: MutableMap<Note, Note.LevelSignature> = mutableMapOf()
|
||||||
val followingSet = account.selectedUsersFollowList(KIND3_FOLLOWS) ?: emptySet()
|
val followingSet = account.selectedUsersFollowList(KIND3_FOLLOWS) ?: emptySet()
|
||||||
val eventsToWatch = ThreadAssembler().findThreadFor(noteId)
|
val eventsToWatch = ThreadAssembler().findThreadFor(noteId)
|
||||||
|
val eventsInHex = eventsToWatch.map { it.idHex }.toSet()
|
||||||
val now = TimeUtils.now()
|
val now = TimeUtils.now()
|
||||||
|
|
||||||
// Currently orders by date of each event, descending, at each level of the reply stack
|
// Currently orders by date of each event, descending, at each level of the reply stack
|
||||||
val order = compareByDescending<Note> {
|
val order = compareByDescending<Note> {
|
||||||
it.replyLevelSignature(eventsToWatch, cachedSignatures, account.userProfile(), followingSet, now).signature
|
it.replyLevelSignature(eventsInHex, cachedSignatures, account.userProfile(), followingSet, now).signature
|
||||||
}
|
}
|
||||||
|
|
||||||
return eventsToWatch.sortedWith(order)
|
return eventsToWatch.sortedWith(order)
|
||||||
|
|
Ładowanie…
Reference in New Issue