From d44c8f79121a552ae6e1309ae386e4431e6241db Mon Sep 17 00:00:00 2001 From: sean-brydon <55134778+sean-brydon@users.noreply.github.com> Date: Fri, 17 Jun 2022 10:02:29 +0100 Subject: [PATCH] Stops users who are not in getting the "Requires confirmation" email (#3084) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update Email * Remove console.debug * Remove redundant assignment Co-authored-by: Omar López * Update apps/web/pages/api/book/confirm.ts * Fix E2E test Co-authored-by: Peer Richelsen Co-authored-by: Omar López Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- apps/web/pages/api/book/confirm.ts | 2 ++ apps/web/pages/api/book/event.ts | 1 + apps/web/playwright/integrations.test.ts | 1 + .../webhookResponse-chromium.txt | 2 +- packages/emails/src/components/LocationInfo.tsx | 3 +-- packages/types/Calendar.d.ts | 1 + 6 files changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/web/pages/api/book/confirm.ts b/apps/web/pages/api/book/confirm.ts index 1f1beb6024..204c99a9bb 100644 --- a/apps/web/pages/api/book/confirm.ts +++ b/apps/web/pages/api/book/confirm.ts @@ -105,6 +105,7 @@ async function patchHandler(req: NextApiRequest) { eventType: { select: { recurringEvent: true, + requiresConfirmation: true, }, }, location: true, @@ -176,6 +177,7 @@ async function patchHandler(req: NextApiRequest) { location: booking.location ?? "", uid: booking.uid, destinationCalendar: booking?.destinationCalendar || currentUser.destinationCalendar, + requiresConfirmation: booking?.eventType?.requiresConfirmation ?? false, }; const recurringEvent = parseRecurringEvent(booking.eventType?.recurringEvent); diff --git a/apps/web/pages/api/book/event.ts b/apps/web/pages/api/book/event.ts index 1399d40962..aea5603d4b 100644 --- a/apps/web/pages/api/book/event.ts +++ b/apps/web/pages/api/book/event.ts @@ -402,6 +402,7 @@ async function handler(req: NextApiRequest) { /** For team events & dynamic collective events, we will need to handle each member destinationCalendar eventually */ destinationCalendar: eventType.destinationCalendar || organizerUser.destinationCalendar, hideCalendarNotes: eventType.hideCalendarNotes, + requiresConfirmation: eventType.requiresConfirmation ?? false, }; if (eventType.schedulingType === SchedulingType.COLLECTIVE) { diff --git a/apps/web/playwright/integrations.test.ts b/apps/web/playwright/integrations.test.ts index 2d918fcb84..b078d9dc35 100644 --- a/apps/web/playwright/integrations.test.ts +++ b/apps/web/playwright/integrations.test.ts @@ -75,6 +75,7 @@ test.describe("Integrations", () => { body.payload.uid = dynamic; body.payload.bookingId = dynamic; body.payload.additionalInformation = dynamic; + body.payload.requiresConfirmation = dynamic; // if we change the shape of our webhooks, we can simply update this by clicking `u` // console.log("BODY", body); diff --git a/apps/web/playwright/integrations.test.ts-snapshots/webhookResponse-chromium.txt b/apps/web/playwright/integrations.test.ts-snapshots/webhookResponse-chromium.txt index b71943b371..283a523db6 100644 --- a/apps/web/playwright/integrations.test.ts-snapshots/webhookResponse-chromium.txt +++ b/apps/web/playwright/integrations.test.ts-snapshots/webhookResponse-chromium.txt @@ -1 +1 @@ -{"triggerEvent":"BOOKING_CREATED","createdAt":"[redacted/dynamic]","payload":{"type":"30 min","title":"30 min between PRO and Test Testson","description":"","additionalNotes":"","customInputs":{},"startTime":"[redacted/dynamic]","endTime":"[redacted/dynamic]","organizer":{"name":"PRO","email":"[redacted/dynamic]","timeZone":"[redacted/dynamic]","language":"[redacted/dynamic]"},"attendees":[{"email":"test@example.com","name":"Test Testson","timeZone":"[redacted/dynamic]","language":"[redacted/dynamic]"}],"location":"[redacted/dynamic]","destinationCalendar":null,"hideCalendarNotes":false,"uid":"[redacted/dynamic]","bookingId":"[redacted/dynamic]","metadata":{},"additionalInformation":"[redacted/dynamic]"}} \ No newline at end of file +{"triggerEvent":"BOOKING_CREATED","createdAt":"[redacted/dynamic]","payload":{"type":"30 min","title":"30 min between PRO and Test Testson","description":"","additionalNotes":"","customInputs":{},"startTime":"[redacted/dynamic]","endTime":"[redacted/dynamic]","organizer":{"name":"PRO","email":"[redacted/dynamic]","timeZone":"[redacted/dynamic]","language":"[redacted/dynamic]"},"attendees":[{"email":"test@example.com","name":"Test Testson","timeZone":"[redacted/dynamic]","language":"[redacted/dynamic]"}],"location":"[redacted/dynamic]","destinationCalendar":null,"hideCalendarNotes":false,"requiresConfirmation":"[redacted/dynamic]","uid":"[redacted/dynamic]","bookingId":"[redacted/dynamic]","metadata":{},"additionalInformation":"[redacted/dynamic]"}} \ No newline at end of file diff --git a/packages/emails/src/components/LocationInfo.tsx b/packages/emails/src/components/LocationInfo.tsx index 4a985aac66..7926cd9c2b 100644 --- a/packages/emails/src/components/LocationInfo.tsx +++ b/packages/emails/src/components/LocationInfo.tsx @@ -108,14 +108,13 @@ export function LocationInfo(props: { calEvent: CalendarEvent; t: TFunction }) { /> ); } - return ( <>{t("meeting_url_provided_after_confirmed")}

diff --git a/packages/types/Calendar.d.ts b/packages/types/Calendar.d.ts index b867a11756..c8be77934b 100644 --- a/packages/types/Calendar.d.ts +++ b/packages/types/Calendar.d.ts @@ -116,6 +116,7 @@ export interface CalendarEvent { uid?: string | null; videoCallData?: VideoCallData; paymentInfo?: PaymentInfo | null; + requiresConfirmation?: boolean | null; destinationCalendar?: DestinationCalendar | null; cancellationReason?: string | null; rejectionReason?: string | null;