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:
+6
-6
@@ -35,7 +35,7 @@ import com.vitorpamplona.quartz.nip01Core.tags.kinds.kind
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.PTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.PTag.Companion.parse
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.PTag.Companion.parseKey
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.taggedUsers
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.toPTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
import kotlinx.serialization.json.JsonNull.content
|
||||
@@ -68,10 +68,10 @@ class WakeUpEvent(
|
||||
const val KIND = 23903
|
||||
const val ALT_DESCRIPTION = "WakeUp"
|
||||
|
||||
// Tags the audience of [about] (its `p` tags) as the recipients to wake up.
|
||||
// The about event's author is NOT tagged: a WakeUp about a zap from Alice
|
||||
// to Bob should notify Bob, not Alice. Callers can add more recipients via
|
||||
// [initializer].
|
||||
// p-tags on a WakeUp identify the AUTHORS of the referenced events —
|
||||
// the people whose events are the subject of the wake-up and who should
|
||||
// come online to handle new activity on them. Callers can add extra
|
||||
// e/p tags via [initializer] when waking up about multiple events.
|
||||
fun build(
|
||||
about: EventHintBundle<Event>,
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
@@ -79,7 +79,7 @@ class WakeUpEvent(
|
||||
) = eventTemplate(KIND, content, createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
about(about)
|
||||
notify(about.event.tags.taggedUsers())
|
||||
notify(about.toPTag())
|
||||
kind(about.event.kind)
|
||||
initializer()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user