From f0f57a93ff7cd5f25c1b298c5cc061ff6b5bdbb3 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 10 Jul 2026 23:10:03 +0000 Subject: [PATCH] fix: record relay attribution for repost and community-approval notes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Non-chat audit follow-up: RepostEvent, GenericRepostEvent, and CommunityPostApprovalEvent consumes never called note.addRelay, so those notes carried an empty relay list forever. - CommunityPostApprovalEvent is badge-rendered directly in community feeds (BadgeBox has no repost-style indirection for it), so its relay icon row was always empty. - Repost badges borrow the boosted note's relays in BadgeBox, but the repost note's own list feeds relayHintUrl()/relayUrls() for nevent hints when citing or sharing the repost — those fell back to author outbox guesses. Add the standard attribution block (author.addRelayBeingUsed + note.addRelay) before the duplicate check, matching consumeRegularEvent, so both first arrivals and re-deliveries from other relays are recorded. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01YEiq1NMK3q12KGQ2yYhPEp --- .../vitorpamplona/amethyst/model/LocalCache.kt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/LocalCache.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/LocalCache.kt index c2473ad474..58cdad1fc9 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/LocalCache.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/LocalCache.kt @@ -1466,6 +1466,11 @@ object LocalCache : ILocalCache, ICacheProvider { ): Boolean { val note = getOrCreateNote(event.id) + if (relay != null) { + getOrCreateUser(event.pubKey).addRelayBeingUsed(relay, event.createdAt) + note.addRelay(relay) + } + // Already processed this event. if (note.event != null) return false @@ -1496,6 +1501,11 @@ object LocalCache : ILocalCache, ICacheProvider { ): Boolean { val note = getOrCreateNote(event.id) + if (relay != null) { + getOrCreateUser(event.pubKey).addRelayBeingUsed(relay, event.createdAt) + note.addRelay(relay) + } + // Already processed this event. if (note.event != null) return false @@ -1527,6 +1537,14 @@ object LocalCache : ILocalCache, ICacheProvider { ): Boolean { val note = getOrCreateNote(event.id) + // Approval notes are badge-rendered directly in community feeds + // (BadgeBox has no repost-style indirection for them), so without + // this attribution their relay list stays empty forever. + if (relay != null) { + getOrCreateUser(event.pubKey).addRelayBeingUsed(relay, event.createdAt) + note.addRelay(relay) + } + // Already processed this event. if (note.event != null) return false