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>
pull/7821/head^2
Joe Au-Yeung 2023-03-22 10:23:09 -04:00 committed by GitHub
parent 1512551903
commit 49ee5d300b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 7 deletions

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 [];

View File

@ -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;