diff --git a/src/modules/events/components/CreateEventDialog.vue b/src/modules/events/components/CreateEventDialog.vue index ea10109..7bd43a0 100644 --- a/src/modules/events/components/CreateEventDialog.vue +++ b/src/modules/events/components/CreateEventDialog.vue @@ -146,7 +146,11 @@ const formSchema = toTypedSchema( .array(z.enum(['lightning', 'fiat'])) .min(1, 'Enable at least one payment method'), fiat_currency: z.string().default("USD"), - amount_tickets: z.number().min(0).max(100000).default(0), + // Required, and at least 1. A capacity of 0 used to mean + // "unlimited", but the backend reads `amount_tickets < 1` as sold + // out everywhere (aiolabs/events#34), so a 0 produced an event that + // advertised unlimited tickets and refused every purchase. + amount_tickets: z.number().min(1, 'Set how many tickets are on sale').max(100000), price_per_ticket: z.number().min(0).default(0), email_notifications: z.boolean().default(false), nostr_notifications: z.boolean().default(false), @@ -195,7 +199,7 @@ const form = useForm({ currency: 'sat', payment_methods: ['lightning'], fiat_currency: 'USD', - amount_tickets: 0, + amount_tickets: undefined, price_per_ticket: 0, email_notifications: false, nostr_notifications: false, @@ -306,7 +310,9 @@ async function populateFromEvent(event: TicketedEvent) { currency: event.currency ?? 'sat', payment_methods: paymentMethodsOf(event), fiat_currency: event.fiat_currency ?? 'USD', - amount_tickets: event.amount_tickets ?? 0, + // 0 is no longer a valid capacity, so an existing zero-capacity event + // opens with the field empty and the organiser has to set a real one. + amount_tickets: event.amount_tickets || undefined, price_per_ticket: event.price_per_ticket ?? 0, email_notifications: event.extra?.email_notifications ?? false, nostr_notifications: event.extra?.nostr_notifications ?? false, @@ -429,7 +435,8 @@ const onSubmit = form.handleSubmit(async (formValues) => { if (acceptsFiat && formValues.fiat_currency) { eventData.fiat_currency = formValues.fiat_currency } - if (formValues.amount_tickets) eventData.amount_tickets = formValues.amount_tickets + if (formValues.amount_tickets !== undefined) + eventData.amount_tickets = formValues.amount_tickets if (formValues.price_per_ticket) eventData.price_per_ticket = formValues.price_per_ticket if (selectedCategories.value.length > 0) eventData.categories = selectedCategories.value @@ -693,9 +700,9 @@ const handleOpenChange = (open: boolean) => { Tickets - + - 0 = unlimited + Total on sale diff --git a/src/modules/events/views/MyEventsPage.vue b/src/modules/events/views/MyEventsPage.vue index 4eb0c7c..a6a3405 100644 --- a/src/modules/events/views/MyEventsPage.vue +++ b/src/modules/events/views/MyEventsPage.vue @@ -173,7 +173,7 @@ function handleEventChanged() {
Tickets Available: - {{ event.amount_tickets - event.sold }} + {{ event.amount_tickets }}
Price: @@ -187,7 +187,7 @@ function handleEventChanged() { variant="default" :disabled=" event.status !== 'approved' || - event.amount_tickets <= event.sold || + event.amount_tickets < 1 || !isAuthenticated " @click="handlePurchaseClick(event)"