mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-10 08:27:04 +00:00
fix: record relay attribution for repost and community-approval notes
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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YEiq1NMK3q12KGQ2yYhPEp
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user