From a5e8bdd43a80c223dc51a5b1f082902092db01aa Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Mon, 19 May 2025 17:42:16 -0400 Subject: [PATCH] Fixes NIP-22 identifier for geotags --- .../vitorpamplona/quartz/nip22Comments/CommentEvent.kt | 8 ++++++++ .../quartz/nip22Comments/tags/RootIdentifierTag.kt | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/quartz/src/main/java/com/vitorpamplona/quartz/nip22Comments/CommentEvent.kt b/quartz/src/main/java/com/vitorpamplona/quartz/nip22Comments/CommentEvent.kt index 73498b7b7..b5a326e4a 100644 --- a/quartz/src/main/java/com/vitorpamplona/quartz/nip22Comments/CommentEvent.kt +++ b/quartz/src/main/java/com/vitorpamplona/quartz/nip22Comments/CommentEvent.kt @@ -74,6 +74,14 @@ class CommentEvent( fun replyAuthors() = tags.filter(ReplyAuthorTag::match) + fun rootAuthorKeys() = tags.mapNotNull(RootAuthorTag::parseKey) + + fun replyAuthorKeys() = tags.mapNotNull(ReplyAuthorTag::parseKey) + + fun rootAuthorHints() = tags.mapNotNull(RootAuthorTag::parseAsHint) + + fun replyAuthorHints() = tags.mapNotNull(ReplyAuthorTag::parseAsHint) + fun rootScopes() = tags.filter { RootIdentifierTag.match(it) || RootAddressTag.match(it) || RootEventTag.match(it) } fun rootKinds() = tags.filter(RootKindTag::match) diff --git a/quartz/src/main/java/com/vitorpamplona/quartz/nip22Comments/tags/RootIdentifierTag.kt b/quartz/src/main/java/com/vitorpamplona/quartz/nip22Comments/tags/RootIdentifierTag.kt index 384a892a2..3e72a57e3 100644 --- a/quartz/src/main/java/com/vitorpamplona/quartz/nip22Comments/tags/RootIdentifierTag.kt +++ b/quartz/src/main/java/com/vitorpamplona/quartz/nip22Comments/tags/RootIdentifierTag.kt @@ -54,7 +54,7 @@ class RootIdentifierTag { @JvmStatic fun assemble(id: ExternalId): List> = when (id) { - is GeohashId -> GeoHashTag.geoMipMap(id.geohash).map { assemble(it, id.hint) } + is GeohashId -> GeoHashTag.geoMipMap(id.geohash).map { assemble(GeohashId.toScope(it), id.hint) } else -> listOf(assemble(id.toScope(), id.hint())) } }