Scheduling infrastructure for absolutely everyone.
fix: respect `hideCalendarNotes` setting during booking reschedule (#25945)
Rajiv Sahal851aa30829c8
diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.jsonindex ceb5f212cb5..bf207402ec9 100644--- a/apps/web/public/static/locales/en/common.json+++ b/apps/web/public/static/locales/en/common.json@@ -1108,6 +1108,7 @@"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. <0>Learn more</0>",+ "notes_hidden_by_organizer": "Notes have been hidden by the organizer","requires_confirmation_description": "The booking needs to be manually confirmed before it is pushed to your calendar and a confirmation is sent. <0>Learn more</0>","requires_confirmation_will_block_slot_description": "Unconfirmed bookings still block calendar slots.","recurring_event": "Recurring event",diff --git a/packages/emails/email-manager.ts b/packages/emails/email-manager.tsindex 493c27880b6..5601b1b506c 100644--- a/packages/emails/email-manager.ts+++ b/packages/emails/email-manager.ts@@ -212,7 +212,18 @@ export const sendRoundRobinRescheduledEmailsAndSMS = async (if (!shouldSkipAttendeeEmailWithSettings(eventTypeMetadata, organizationSettings, EmailType.RESCHEDULED)) {- emailsAndSMSToSend.push(sendEmail(() => new AttendeeRescheduledEmail(calendarEvent, person)));+ emailsAndSMSToSend.push(+ sendEmail(+ () =>+ new AttendeeRescheduledEmail(+ {+ ...calendarEvent,+ ...(calendarEvent.hideCalendarNotes && { additionalNotes: undefined }),+ },+ person+ )+ )+ );if (person.phoneNumber) {emailsAndSMSToSend.push(successfullyReScheduledSMS.sendSMSToAttendee(person));}@@ -322,7 +333,16 @@ const _sendRescheduledEmailsAndSMS = async (if (!shouldSkipAttendeeEmailWithSettings(eventTypeMetadata, organizationSettings, EmailType.RESCHEDULED)) {emailsToSend.push(...calendarEvent.attendees.map((attendee) => {- return sendEmail(() => new AttendeeRescheduledEmail(calendarEvent, attendee));+ return sendEmail(+ () =>+ new AttendeeRescheduledEmail(+ {+ ...calendarEvent,+ ...(calendarEvent.hideCalendarNotes && { additionalNotes: undefined }),+ },+ attendee+ )+ );}));}@@ -350,7 +370,18 @@ export const sendRescheduledSeatEmailAndSMS = async (if (!eventTypeDisableHostEmail(eventTypeMetadata))emailsToSend.push(sendEmail(() => new OrganizerRescheduledEmail({ calEvent: calendarEvent })));if (!shouldSkipAttendeeEmailWithSettings(eventTypeMetadata, organizationSettings, EmailType.RESCHEDULED))- emailsToSend.push(sendEmail(() => new AttendeeRescheduledEmail(clonedCalEvent, attendee)));+ emailsToSend.push(+ sendEmail(+ () =>+ new AttendeeRescheduledEmail(+ {+ ...clonedCalEvent,+ ...(clonedCalEvent.hideCalendarNotes && { additionalNotes: undefined }),+ },+ attendee+ )+ )+ );const successfullyReScheduledSMS = new EventSuccessfullyReScheduledSMS(calEvent);await successfullyReScheduledSMS.sendSMSToAttendee(attendee);diff --git a/packages/features/bookings/lib/service/RegularBookingService.ts b/packages/features/bookings/lib/service/RegularBookingService.tsindex 3cc213627f6..2d00da24214 100644--- a/packages/features/bookings/lib/service/RegularBookingService.ts+++ b/packages/features/bookings/lib/service/RegularBookingService.ts@@ -2094,6 +2094,10 @@ async function handler(});}}+ // This gets overridden when updating the event - to check if notes have been hidden or not. We just reset this back+ // to the default description when we are sending the emails.+ evt.description = eventType.description;+const updateManager = !skipCalendarSyncTaskCreation? await eventManager.reschedule(evt,@@ -2105,9 +2109,6 @@ async function handler(skipDeleteEventsAndMeetings): placeholderCreatedEvent;- // This gets overridden when updating the event - to check if notes have been hidden or not. We just reset this back- // to the default description when we are sending the emails.- evt.description = eventType.description ?? evt.description;results = updateManager.results;referencesToCreate = updateManager.referencesToCreate;diff --git a/packages/features/calendars/lib/CalendarManager.ts b/packages/features/calendars/lib/CalendarManager.tsindex 7a86d0fe3c5..caf1785275d 100644--- a/packages/features/calendars/lib/CalendarManager.ts+++ b/packages/features/calendars/lib/CalendarManager.ts@@ -388,6 +388,11 @@ export const updateEvent = async (externalCalendarId: string | null): Promise<EventResult<NewCalendarEventType>> => {const formattedEvent = formatCalEvent(rawCalEvent);++ if (formattedEvent.hideCalendarNotes) {+ formattedEvent.additionalNotes = "Notes have been hidden by the organizer"; // TODO: i18n this string?+ }+const calEvent = processEvent(formattedEvent);const uid = getUid(calEvent);const calendar = await getCalendar(credential, "booking");@@ -500,7 +505,7 @@ export const deleteEvent = async ({* Process the calendar event by generating description and removing attendees if needed*/const processEvent = (calEvent: CalendarEvent): CalendarServiceEvent => {- if (calEvent.seatsPerTimeSlot){+ if (calEvent.seatsPerTimeSlot) {calEvent.responses = null;calEvent.userFieldsResponses = null;calEvent.additionalNotes = null;