From 262e674f9f8b29b6f0f5307a1526afb7f3c56753 Mon Sep 17 00:00:00 2001 From: Padreug Date: Thu, 10 Sep 2026 12:22:13 +0200 Subject: [PATCH] fix(events): let the organizer's own record win when merging My Events The authenticated fetch returns the full Event (incl. extra.promo_codes, which public responses omit as of events ext v1.6.1-aio.12) and is what the edit dialog must prefill from. Public records still win for events the user does not own. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01ByAwHU4pRnyE58YocQvAas --- src/modules/events/composables/useMyEvents.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/modules/events/composables/useMyEvents.ts b/src/modules/events/composables/useMyEvents.ts index 9def6d1..2012614 100644 --- a/src/modules/events/composables/useMyEvents.ts +++ b/src/modules/events/composables/useMyEvents.ts @@ -13,9 +13,10 @@ export function useMyEvents() { // and merge them into the feed. Otherwise an event that drops to // `proposed` after a non-admin edit disappears from the user's view // entirely — they'd be unable to find it to make a follow-up edit or - // monitor its approval status. Public approved events from other - // users take precedence on dedup (server is the source of truth for - // the public view). + // monitor its approval status. For the user's OWN events the + // authenticated record wins on dedup: it is the full `Event` (incl. + // `extra.promo_codes`, which public responses omit), and it is what + // the edit dialog must prefill from. const fetchAll = async (): Promise => { const publicEvents = (await ticketApi.fetchTicketedEvents()) as TicketedEvent[] @@ -26,9 +27,11 @@ export function useMyEvents() { try { const myEvents = (await ticketApi.fetchMyEvents(invoiceKey)) as TicketedEvent[] - const seen = new Set(publicEvents.map((e) => e.id)) - const own = myEvents.filter((e) => !seen.has(e.id)) - return [...publicEvents, ...own] + const own = new Map(myEvents.map((e) => [e.id, e])) + const merged = publicEvents.map((e) => own.get(e.id) ?? e) + const publicIds = new Set(publicEvents.map((e) => e.id)) + const ownOnly = myEvents.filter((e) => !publicIds.has(e.id)) + return [...merged, ...ownOnly] } catch (err) { // Falling back to just the public feed is acceptable — the user // can still browse, they just won't see their own pending events.