Makes sure the note is always added in the threadView

pull/167/head
Vitor Pamplona 2023-02-24 10:08:35 -05:00
rodzic de26417391
commit b1bdd20255
1 zmienionych plików z 2 dodań i 2 usunięć

Wyświetl plik

@ -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)