Fix rescheduling updating calendars & duplicate bookings (#7851)

* Fix rescheduling

* Fix tests

* Clean up

* Update packages/core/EventManager.ts

Co-authored-by: Syed Ali Shahbaz <52925846+alishaz-polymath@users.noreply.github.com>

* Commit fix

---------

Co-authored-by: Syed Ali Shahbaz <52925846+alishaz-polymath@users.noreply.github.com>
Co-authored-by: Peer Richelsen <peeroke@gmail.com>
This commit is contained in:
Joe Au-Yeung
2023-03-22 15:23:09 +01:00
committed by GitHub
co-authored by Syed Ali Shahbaz Peer Richelsen
parent 1512551903
commit 49ee5d300b
2 changed files with 4 additions and 7 deletions
+3 -6
View File
@@ -439,12 +439,9 @@ export default class EventManager {
});
}
if (newBooking) {
calendarReference = newBooking.references.find((reference) => reference.type.includes("_calendar"));
} else {
// Bookings should only have one calendar reference
calendarReference = booking.references.find((reference) => reference.type.includes("_calendar"));
}
calendarReference = newBooking?.references.length
? newBooking.references.find((reference) => reference.type.includes("_calendar"))
: booking.references.find((reference) => reference.type.includes("_calendar"));
if (!calendarReference) {
return [];
@@ -1655,7 +1655,7 @@ async function handler(
// Use EventManager to conditionally use all needed integrations.
const updateManager = await eventManager.reschedule(evt, originalRescheduledBooking.uid, booking?.id);
const updateManager = await eventManager.reschedule(evt, originalRescheduledBooking.uid);
// 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;