From a5e5bd25ae87aaca6530d05d12ee44191638458f Mon Sep 17 00:00:00 2001 From: Kgothatso Ngako Date: Fri, 1 May 2026 19:16:31 +0200 Subject: [PATCH] Get Quote note by parsing it. --- .../compose/database/model/NostrEvent.kt | 29 +++++++++---------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/database/model/NostrEvent.kt b/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/database/model/NostrEvent.kt index ed110b4f..f5eea138 100644 --- a/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/database/model/NostrEvent.kt +++ b/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/database/model/NostrEvent.kt @@ -277,22 +277,19 @@ data class NostrEvent( } } - return null - // TODO: Bring in quoted text -// val quotedNotes = ContentParser.parse(content.trimEnd('\n', '\r'), emptyMap(), emptyMap(), trimBlankLines = true) -// .filterIsInstance() -// .firstOrNull() -// -// return quotedNotes?.let { quotedNote -> -// QuotedRelation( -// quotedNostrEventId = quotedNote.eventId, -// quotedProfilePublicKey = null -// , -// -// quotingNostrEventId = id, -// createdAt = createdAt -// ) -// } + val quotedNotes = ContentParser.parse(content.trimEnd('\n', '\r'), emptyMap(), emptyMap(), trimBlankLines = true) + .filterIsInstance() + .firstOrNull() + + return quotedNotes?.let { quotedNote -> + QuotedRelation( + quotedNostrEventId = quotedNote.eventId, + quotedProfilePublicKey = null, + + quotingNostrEventId = id, + createdAt = createdAt + ) + } } catch (e: Throwable) { logger.e("Failed to return Repost: ", e) return null