fix: rescheduling in round robin (#14109)

* fix: rescheduling in round robin

* chore: remove new calendar

* chore: update logic

* fix: simplify code

* chore: update deletevents
This commit is contained in:
Udit Takkar authored and GitHub committed 2024-03-21 11:35:34 +00:00
1 parent 0ad82bdf52
commit 0fc79f93de
2 files changed
+25 -14

No files matched your search

@@ -1747,18 +1747,22 @@ async function handler(
evt = addVideoCallDataToEvent(originalRescheduledBooking.references, evt);
const newDestinationCalendar = evt.destinationCalendar;
evt.destinationCalendar = originalRescheduledBooking?.destinationCalendar
// If organizer is changed in RR event then we need to delete the previous host destination calendar events
const previousHostDestinationCalendar = originalRescheduledBooking?.destinationCalendar
? [originalRescheduledBooking?.destinationCalendar]
: originalRescheduledBooking?.user?.destinationCalendar
? [originalRescheduledBooking?.user.destinationCalendar]
: evt.destinationCalendar;
: [];
if (changedOrganizer) {
evt.title = getEventName(eventNameObject);
// location might changed and will be new created in eventManager.create (organizer default location)
evt.videoCallData = undefined;
// To prevent "The requested identifier already exists" error while updating event, we need to remove iCalUID
evt.iCalUID = undefined;
} else {
// In case of rescheduling, we need to keep the previous host destination calendar
evt.destinationCalendar = originalRescheduledBooking?.destinationCalendar
? [originalRescheduledBooking?.destinationCalendar]
: evt.destinationCalendar;
}
const updateManager = await eventManager.reschedule(
@@ -1766,7 +1770,7 @@ async function handler(
originalRescheduledBooking.uid,
undefined,
changedOrganizer,
newDestinationCalendar
previousHostDestinationCalendar
);
// This gets overridden when updating the event - to check if notes have been hidden or not. We just reset this back
@@ -1864,6 +1868,7 @@ async function handler(
metadata.hangoutLink ||
results[0].createdEvent?.url ||
organizerOrFirstDynamicGroupMemberDefaultLocationUrl ||
getVideoCallUrlFromCalEvent(evt) ||
videoCallUrl;
}