Skip to content

Commit 851aa30

Browse files
authored
fix: respect hideCalendarNotes setting during booking reschedule (calcom#25945)
Add hideCalendarNotes support to reschedule flow The hideCalendarNotes flag was only handled in CalendarManager.createEvent(), not in updateEvent(). This caused notes to become visible again in ICS files after rescheduling. Changes: - Add hideCalendarNotes handling to CalendarManager.updateEvent() - Add hideCalendarNotes checks to reschedule email functions - Move description reset before reschedule call (required for cloned event)
1 parent 2664eb4 commit 851aa30

4 files changed

Lines changed: 45 additions & 7 deletions

File tree

apps/web/public/static/locales/en/common.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,6 +1108,7 @@
11081108
"add_input": "Add an input",
11091109
"disable_notes": "Hide notes in calendar",
11101110
"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>",
1111+
"notes_hidden_by_organizer": "Notes have been hidden by the organizer",
11111112
"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>",
11121113
"requires_confirmation_will_block_slot_description": "Unconfirmed bookings still block calendar slots.",
11131114
"recurring_event": "Recurring event",

packages/emails/email-manager.ts

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,18 @@ export const sendRoundRobinRescheduledEmailsAndSMS = async (
212212
if (
213213
!shouldSkipAttendeeEmailWithSettings(eventTypeMetadata, organizationSettings, EmailType.RESCHEDULED)
214214
) {
215-
emailsAndSMSToSend.push(sendEmail(() => new AttendeeRescheduledEmail(calendarEvent, person)));
215+
emailsAndSMSToSend.push(
216+
sendEmail(
217+
() =>
218+
new AttendeeRescheduledEmail(
219+
{
220+
...calendarEvent,
221+
...(calendarEvent.hideCalendarNotes && { additionalNotes: undefined }),
222+
},
223+
person
224+
)
225+
)
226+
);
216227
if (person.phoneNumber) {
217228
emailsAndSMSToSend.push(successfullyReScheduledSMS.sendSMSToAttendee(person));
218229
}
@@ -322,7 +333,16 @@ const _sendRescheduledEmailsAndSMS = async (
322333
if (!shouldSkipAttendeeEmailWithSettings(eventTypeMetadata, organizationSettings, EmailType.RESCHEDULED)) {
323334
emailsToSend.push(
324335
...calendarEvent.attendees.map((attendee) => {
325-
return sendEmail(() => new AttendeeRescheduledEmail(calendarEvent, attendee));
336+
return sendEmail(
337+
() =>
338+
new AttendeeRescheduledEmail(
339+
{
340+
...calendarEvent,
341+
...(calendarEvent.hideCalendarNotes && { additionalNotes: undefined }),
342+
},
343+
attendee
344+
)
345+
);
326346
})
327347
);
328348
}
@@ -350,7 +370,18 @@ export const sendRescheduledSeatEmailAndSMS = async (
350370
if (!eventTypeDisableHostEmail(eventTypeMetadata))
351371
emailsToSend.push(sendEmail(() => new OrganizerRescheduledEmail({ calEvent: calendarEvent })));
352372
if (!shouldSkipAttendeeEmailWithSettings(eventTypeMetadata, organizationSettings, EmailType.RESCHEDULED))
353-
emailsToSend.push(sendEmail(() => new AttendeeRescheduledEmail(clonedCalEvent, attendee)));
373+
emailsToSend.push(
374+
sendEmail(
375+
() =>
376+
new AttendeeRescheduledEmail(
377+
{
378+
...clonedCalEvent,
379+
...(clonedCalEvent.hideCalendarNotes && { additionalNotes: undefined }),
380+
},
381+
attendee
382+
)
383+
)
384+
);
354385

355386
const successfullyReScheduledSMS = new EventSuccessfullyReScheduledSMS(calEvent);
356387
await successfullyReScheduledSMS.sendSMSToAttendee(attendee);

packages/features/bookings/lib/service/RegularBookingService.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2094,6 +2094,10 @@ async function handler(
20942094
});
20952095
}
20962096
}
2097+
// This gets overridden when updating the event - to check if notes have been hidden or not. We just reset this back
2098+
// to the default description when we are sending the emails.
2099+
evt.description = eventType.description;
2100+
20972101
const updateManager = !skipCalendarSyncTaskCreation
20982102
? await eventManager.reschedule(
20992103
evt,
@@ -2105,9 +2109,6 @@ async function handler(
21052109
skipDeleteEventsAndMeetings
21062110
)
21072111
: placeholderCreatedEvent;
2108-
// This gets overridden when updating the event - to check if notes have been hidden or not. We just reset this back
2109-
// to the default description when we are sending the emails.
2110-
evt.description = eventType.description ?? evt.description;
21112112

21122113
results = updateManager.results;
21132114
referencesToCreate = updateManager.referencesToCreate;

packages/features/calendars/lib/CalendarManager.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,11 @@ export const updateEvent = async (
388388
externalCalendarId: string | null
389389
): Promise<EventResult<NewCalendarEventType>> => {
390390
const formattedEvent = formatCalEvent(rawCalEvent);
391+
392+
if (formattedEvent.hideCalendarNotes) {
393+
formattedEvent.additionalNotes = "Notes have been hidden by the organizer"; // TODO: i18n this string?
394+
}
395+
391396
const calEvent = processEvent(formattedEvent);
392397
const uid = getUid(calEvent);
393398
const calendar = await getCalendar(credential, "booking");
@@ -500,7 +505,7 @@ export const deleteEvent = async ({
500505
* Process the calendar event by generating description and removing attendees if needed
501506
*/
502507
const processEvent = (calEvent: CalendarEvent): CalendarServiceEvent => {
503-
if (calEvent.seatsPerTimeSlot){
508+
if (calEvent.seatsPerTimeSlot) {
504509
calEvent.responses = null;
505510
calEvent.userFieldsResponses = null;
506511
calEvent.additionalNotes = null;

0 commit comments

Comments
 (0)