fix: align WakeUp handling with spec semantics (p-tags = authors)
A previous commit misread the spec: p-tags on a WakeUp identify the AUTHORS of the referenced events (the people whose events are the subject of the wake-up), not the recipients. The consumer's existing npub-in-p-tag match is therefore correct — "is this logged-in account the author of a referenced event?". - Revert WakeUpEvent.build() back to notify(about.toPTag()) and replace the comment with a spec-accurate one. - In wakeUpFor, source author pubkeys from event.authorKeys() (p-tags, canonical) first, merge in the e-tag author hints, and fall back to the WakeUp signer only when both are empty. Bound by MAX_WAKEUP_REFS. computeReplyTo and the referenced-event fetch path remain untouched — those fixes are orthogonal to the p-tag semantic.
This commit is contained in:
+8
-7
@@ -204,16 +204,17 @@ class EventNotificationConsumer(
|
||||
return
|
||||
}
|
||||
|
||||
// The referenced event's author is who the user will see in the final
|
||||
// notification ("Alice zapped you"). The WakeUp's own pubKey is typically
|
||||
// a push bot and not useful. Fall back to it only when the `e` tag omits
|
||||
// the author hint.
|
||||
// Per spec, p-tags on a WakeUp are the authors of the referenced
|
||||
// events; those are whose metadata we need to render the notification.
|
||||
// Fall back to e-tag author hints and finally to the WakeUp signer.
|
||||
val referencedNotes = referencedTags.map { LocalCache.getOrCreateNote(it.eventId) }
|
||||
val authorCandidates =
|
||||
referencedTags
|
||||
.mapNotNull { it.author }
|
||||
val authorKeys =
|
||||
(event.authorKeys() + referencedTags.mapNotNull { it.author })
|
||||
.distinct()
|
||||
.ifEmpty { listOf(event.pubKey) }
|
||||
val authorCandidates =
|
||||
authorKeys
|
||||
.take(MAX_WAKEUP_REFS)
|
||||
.map { LocalCache.getOrCreateUser(it) }
|
||||
|
||||
coroutineScope {
|
||||
|
||||
Reference in New Issue
Block a user