Scheduling infrastructure for absolutely everyone.
Feat - disable notes (#2249)
sean-brydonbd66ca183fa4
diff --git a/apps/web/pages/api/book/event.ts b/apps/web/pages/api/book/event.tsindex 5eb9d16729f..d9e2f7dd964 100644--- a/apps/web/pages/api/book/event.ts+++ b/apps/web/pages/api/book/event.ts@@ -232,6 +232,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)currency: true,metadata: true,destinationCalendar: true,+ hideCalendarNotes: true,},});@@ -342,6 +343,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)location: reqBody.location, // Will be processed by the EventManager later./** For team events, we will need to handle each member destinationCalendar eventually */destinationCalendar: eventType.destinationCalendar || users[0].destinationCalendar,+ hideCalendarNotes: eventType.hideCalendarNotes,};if (eventType.schedulingType === SchedulingType.COLLECTIVE) {diff --git a/apps/web/playwright/integrations.test.ts-snapshots/webhookResponse-chromium.txt b/apps/web/playwright/integrations.test.ts-snapshots/webhookResponse-chromium.txtindex c67a19324cb..51471113be7 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":"30min","title":"30min between Pro Example and Test Testson","description":"","startTime":"[redacted/dynamic]","endTime":"[redacted/dynamic]","organizer":{"name":"Pro Example","email":"[email protected]","timeZone":"[redacted/dynamic]","language":"[redacted/dynamic]"},"attendees":[{"email":"[email protected]","name":"Test Testson","timeZone":"[redacted/dynamic]","language":"[redacted/dynamic]"}],"location":"[redacted/dynamic]","destinationCalendar":null,"uid":"[redacted/dynamic]","metadata":{},"additionInformation":"[redacted/dynamic]"}}\ No newline at end of file+{"triggerEvent":"BOOKING_CREATED","createdAt":"[redacted/dynamic]","payload":{"type":"30min","title":"30min between Pro Example and Test Testson","description":"","startTime":"[redacted/dynamic]","endTime":"[redacted/dynamic]","organizer":{"name":"Pro Example","email":"[email protected]","timeZone":"[redacted/dynamic]","language":"[redacted/dynamic]"},"attendees":[{"email":"[email protected]","name":"Test Testson","timeZone":"[redacted/dynamic]","language":"[redacted/dynamic]"}],"location":"[redacted/dynamic]","destinationCalendar":null,"hideCalendarNotes":false,"uid":"[redacted/dynamic]","metadata":{},"additionInformation":"[redacted/dynamic]"}}\ No newline at end of filediff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.jsonindex 7ade26b4d34..bc212f9d19b 100644--- a/apps/web/public/static/locales/en/common.json+++ b/apps/web/public/static/locales/en/common.json@@ -566,6 +566,8 @@"type": "Type","edit": "Edit","add_input": "Add an Input",+ "disable_notes": "Hide notes in calendar",+ "disable_notes_description": "For privacy reasons, additional inputs and notes will be hidden in the calendar entry. They will still be sent to your email.","opt_in_booking": "Opt-in Booking","opt_in_booking_description": "The booking needs to be manually confirmed before it is pushed to the integrations and a confirmation mail is sent.","disable_guests": "Disable Guests",diff --git a/packages/core/CalendarManager.ts b/packages/core/CalendarManager.tsindex 961a4dfdb47..8b6f544cdda 100644--- a/packages/core/CalendarManager.ts+++ b/packages/core/CalendarManager.ts@@ -102,12 +102,17 @@ export const createEvent = async (credential: Credential, calEvent: CalendarEvenconst calendar = getCalendar(credential);let success = true;+ // Check if the disabledNotes flag is set to true+ if (calEvent.hideCalendarNotes) {+ calEvent.description = "Notes have been hidden by the organiser"; // TODO: i18n this string?+ }+const creationResult = calendar? await calendar.createEvent(calEvent).catch((e) => {- log.error("createEvent failed", e, calEvent);- success = false;- return undefined;- })+ log.error("createEvent failed", e, calEvent);+ success = false;+ return undefined;+ }): undefined;return {@@ -131,10 +136,10 @@ export const updateEvent = async (const updatedResult =calendar && bookingRefUid? await calendar.updateEvent(bookingRefUid, calEvent).catch((e) => {- log.error("updateEvent failed", e, calEvent);- success = false;- return undefined;- })+ log.error("updateEvent failed", e, calEvent);+ success = false;+ return undefined;+ }): undefined;return {diff --git a/packages/prisma/migrations/20220323162642_events_hide_notes/migration.sql b/packages/prisma/migrations/20220323162642_events_hide_notes/migration.sqlnew file mode 100644index 00000000000..b0dc40047e4--- /dev/null+++ b/packages/prisma/migrations/20220323162642_events_hide_notes/migration.sql@@ -0,0 +1,2 @@+-- AlterTable+ALTER TABLE "EventType" ADD COLUMN "hideCalendarNotes" BOOLEAN NOT NULL DEFAULT false;diff --git a/packages/prisma/schema.prisma b/packages/prisma/schema.prismaindex 0d8e6087487..6bcf9e3087e 100644--- a/packages/prisma/schema.prisma+++ b/packages/prisma/schema.prisma@@ -58,6 +58,7 @@ model EventType {periodCountCalendarDays Boolean?requiresConfirmation Boolean @default(false)disableGuests Boolean @default(false)+ hideCalendarNotes Boolean @default(false)minimumBookingNotice Int @default(120)beforeEventBuffer Int @default(0)afterEventBuffer Int @default(0)diff --git a/packages/types/Calendar.d.ts b/packages/types/Calendar.d.tsindex 57cd9ea2ef1..0708eb3f317 100644--- a/packages/types/Calendar.d.ts+++ b/packages/types/Calendar.d.ts@@ -91,6 +91,7 @@ export interface CalendarEvent {destinationCalendar?: DestinationCalendar | null;cancellationReason?: string | null;rejectionReason?: string | null;+ hideCalendarNotes?: boolean;}export interface EntryPoint {