From 246a16f110ae00e988a310c8040fffb07655f482 Mon Sep 17 00:00:00 2001 From: Ryderjj89 Date: Mon, 5 May 2025 08:56:16 -0400 Subject: [PATCH] fix: always send RSVP notification emails to admin (EMAIL_USER) instead of RSVP submitter --- backend/src/index.ts | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/backend/src/index.ts b/backend/src/index.ts index 164ceb5..319fc68 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -300,24 +300,22 @@ app.post('/api/events/:slug/rsvp', async (req: Request, res: Response) => { const eventTitle = eventInfo ? eventInfo.title : slug; const eventSlug = eventInfo ? eventInfo.slug : slug; - // Send RSVP confirmation email (if email provided) - if (req.body.email) { - try { - await sendRSVPEmail({ - eventTitle, - eventSlug, - name, - attending, - bringingGuests: bringing_guests, - guestCount: guest_count, - guestNames: parsedGuestNames, - itemsBringing: parsedItemsBringing, - otherItems: other_items || '', - to: req.body.email, - }); - } catch (emailErr) { - console.error('Error sending RSVP email:', emailErr); - } + // Send RSVP confirmation email to admin + try { + await sendRSVPEmail({ + eventTitle, + eventSlug, + name, + attending, + bringingGuests: bringing_guests, + guestCount: guest_count, + guestNames: parsedGuestNames, + itemsBringing: parsedItemsBringing, + otherItems: other_items || '', + to: process.env.EMAIL_USER, + }); + } catch (emailErr) { + console.error('Error sending RSVP email:', emailErr); } // Return the complete RSVP data including the parsed arrays