mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-04-13 14:29:27 +02:00
Makes sure the note is always added in the threadView
This commit is contained in:
parent
de26417391
commit
b1bdd20255
@ -6,6 +6,8 @@ import kotlin.time.measureTimedValue
|
||||
class ThreadAssembler {
|
||||
|
||||
fun searchRoot(note: Note, testedNotes: MutableSet<Note> = mutableSetOf()): Note? {
|
||||
testedNotes.add(note)
|
||||
|
||||
if (note.replyTo == null || note.replyTo?.isEmpty() == true) return note
|
||||
|
||||
val markedAsRoot = note.event?.tags?.firstOrNull { it[0] == "e" && it.size > 3 && it[3] == "root" }?.getOrNull(1)
|
||||
@ -14,8 +16,6 @@ class ThreadAssembler {
|
||||
val hasNoReplyTo = note.replyTo?.firstOrNull { it.replyTo?.isEmpty() == true }
|
||||
if (hasNoReplyTo != null) return hasNoReplyTo
|
||||
|
||||
testedNotes.add(note)
|
||||
|
||||
// recursive
|
||||
val roots = note.replyTo?.map {
|
||||
if (it !in testedNotes)
|
||||
|
Loading…
x
Reference in New Issue
Block a user