fix: respect hideCalendarNotes setting during booking reschedule (#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)
This commit is contained in:
1 parent
2664eb459b
commit
851aa30829
4 files changed
+45
-7
No files matched your search
@@ -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",
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user