fix(events): collapse own-event draft + relay copy into one card #127
No reviewers
Labels
No labels
app:activities
app:chat
app:events
app:forum
app:libra
app:market
app:restaurant
app:tasks
app:wallet
app:webapp
bug
enhancement
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
aiolabs/webapp!127
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/own-event-draft-duplicate"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
A creator's own event renders twice in the events feed — one full card (real organizer profile, price, ticket counts) next to a hollow duplicate (organizer "…", no price, no ticket count, "Yours" badge). Only the logged-in owner of an event sees it.
Root cause — regression from coordinate-keying (#125)
loadOwnEventssurfaces the caller's own LNbits events via REST (ticketedEventToEvent) so drafts show in the feed before their NIP-52 event reaches a relay. That adapter stamps:organizer.pubkey: ''(no Nostr author yet)isMine: trueticketInfoThe relay-published copy lands under the real publisher pubkey —
resolve_for_walletin the events extension, which is not the user's Nostr login key — and carries full ticket counts.Before the store was coordinate-keyed, both copies collapsed onto the bare d-tag, so the relay copy (newer
createdAt) replaced the draft. Underkind:pubkey:d-tag(#125) the empty-pubkey draft and the real-pubkey copy are distinct keys, so both persist → the hollow…/no-tickets card beside the real one. It's owner-only because only own events get the REST merge.Fix
upsertEventnow reconciles by d-tag: the published copy supersedes the provisional draft and inherits itsisMine, so the creator keeps the Yours badge + Hosting filter even though the publisher key differs from their login key (ownership can't be re-derived by pubkey match here). Handles both arrival orderings; a draft with no published copy yet (pending review) still shows alone; two genuinely distinct authors sharing a d-tag are left untouched (the cross-author-hijack guard from #125 is preserved).Tests
4 new store specs (both orderings, pending-draft-alone, distinct-authors-not-folded). Full suite green (19 passed).
Note for review
This exposes a deeper smell: the webapp's ownership check (
organizer.pubkey === myPubkey) assumes the publisher key equals the user's Nostr login key, whichresolve_for_walletbreaks. The draft→publishedisMineinheritance papers over it correctly for owned events; a longer-term fix would tie ownership to the LNbits identity rather than a pubkey match.🤖 Generated with Claude Code