diff --git a/app/src/main/java/com/vitorpamplona/amethyst/service/model/BaseTextNoteEvent.kt b/app/src/main/java/com/vitorpamplona/amethyst/service/model/BaseTextNoteEvent.kt index 93f576f05..4f9e98fce 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/service/model/BaseTextNoteEvent.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/service/model/BaseTextNoteEvent.kt @@ -19,6 +19,7 @@ open class BaseTextNoteEvent( open fun replyTos() = tags.filter { it.firstOrNull() == "e" }.mapNotNull { it.getOrNull(1) } private var citedUsersCache: Set? = null + private var citedNotesCache: Set? = null fun citedUsers(): Set { citedUsersCache?.let { return it } @@ -61,8 +62,10 @@ open class BaseTextNoteEvent( return returningList } - fun findCitations(): Set { - var citations = mutableSetOf() + fun findCitations(): Set { + citedNotesCache?.let { return it } + + val citations = mutableSetOf() // Removes citations from replies: val matcher = tagSearch.matcher(content) while (matcher.find()) { @@ -102,6 +105,7 @@ open class BaseTextNoteEvent( } } + citedNotesCache = citations return citations }