From 304756592013ee0a60ad61fafee5816da9ed7204 Mon Sep 17 00:00:00 2001 From: Padreug Date: Thu, 21 May 2026 15:55:19 +0200 Subject: [PATCH] feat(activities): fetchMyEvents + invoice-key auto_approve probe `fetchMyEvents` hits the existing all_wallets=true endpoint to surface the caller's own events regardless of status. `getAutoApprove` now calls the public probe (invoice-key-gated) added in events extension v1.3.0-aio.5 so non-admin webapp users get accurate edit-flow copy. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../activities/services/TicketApiService.ts | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/modules/activities/services/TicketApiService.ts b/src/modules/activities/services/TicketApiService.ts index 432771d..64c5fdb 100644 --- a/src/modules/activities/services/TicketApiService.ts +++ b/src/modules/activities/services/TicketApiService.ts @@ -34,6 +34,20 @@ export class TicketApiService { return response } + /** + * Fetch the authenticated user's own events across all their wallets, + * regardless of status. Lets the webapp show the user's pending / + * rejected events alongside the public approved feed — without this + * a user who edits under `auto_approve=false` loses sight of their + * own event the moment it drops to `proposed`. + */ + async fetchMyEvents(invoiceKey: string): Promise { + return this.request('/events/api/v1/events?all_wallets=true', { + method: 'GET', + headers: { 'X-API-KEY': invoiceKey }, + }) + } + /** * Request a ticket purchase (creates a Lightning invoice). * Uses POST /tickets/{event_id} with user_id in body (upstream API). @@ -187,14 +201,16 @@ export class TicketApiService { } /** - * Read the extension's auto_approve flag. Admin-only endpoint, so - * non-admin callers see false (the safe default for UI gating). + * Read the extension's auto_approve flag. Hits the public probe + * (invoice-key-gated, available to any wallet holder), so non-admin + * users see the real value and the edit-flow copy is accurate. + * Degrades to `false` on failure — the safer default for warning UI. */ - async getAutoApprove(adminKey: string): Promise { + async getAutoApprove(invoiceKey: string): Promise { try { - const settings = await this.request('/events/api/v1/events/settings', { + const settings = await this.request('/events/api/v1/events/settings/public', { method: 'GET', - headers: { 'X-API-KEY': adminKey }, + headers: { 'X-API-KEY': invoiceKey }, }) return Boolean(settings?.auto_approve) } catch {