fix: meeting link fails when host requests to reschedule (#20999)
* fix: meeting link fails when host requests to reschedule * Update EventManager.ts
This commit is contained in:
@@ -1220,8 +1220,10 @@ async function handler(
|
||||
eventType.schedulingType === SchedulingType.ROUND_ROBIN &&
|
||||
originalRescheduledBooking.userId !== evt.organizer.id;
|
||||
|
||||
const isLocationChanged =
|
||||
!!originalRescheduledBooking && originalRescheduledBooking.location !== evt.location;
|
||||
const isBookingRequestedReschedule =
|
||||
!!originalRescheduledBooking &&
|
||||
!!originalRescheduledBooking.rescheduled &&
|
||||
originalRescheduledBooking.status === BookingStatus.CANCELLED;
|
||||
|
||||
let results: EventResult<AdditionalInformation & { url?: string; iCalUID?: string }>[] = [];
|
||||
let referencesToCreate: PartialReference[] = [];
|
||||
@@ -1411,7 +1413,8 @@ async function handler(
|
||||
originalRescheduledBooking.uid,
|
||||
undefined,
|
||||
changedOrganizer,
|
||||
previousHostDestinationCalendar
|
||||
previousHostDestinationCalendar,
|
||||
isBookingRequestedReschedule
|
||||
);
|
||||
// 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.
|
||||
|
||||
@@ -449,7 +449,8 @@ export default class EventManager {
|
||||
rescheduleUid: string,
|
||||
newBookingId?: number,
|
||||
changedOrganizer?: boolean,
|
||||
previousHostDestinationCalendar?: DestinationCalendar[] | null
|
||||
previousHostDestinationCalendar?: DestinationCalendar[] | null,
|
||||
isBookingRequestedReschedule?: boolean
|
||||
): Promise<CreateUpdateResult> {
|
||||
const originalEvt = processLocation(event);
|
||||
const evt = cloneDeep(originalEvt);
|
||||
@@ -501,7 +502,9 @@ export default class EventManager {
|
||||
|
||||
const results: Array<EventResult<Event>> = [];
|
||||
const updatedBookingReferences: Array<PartialReference> = [];
|
||||
const isLocationChanged = evt.location && booking.location && evt.location !== booking.location;
|
||||
const isLocationChanged = !!evt.location && !!booking.location && evt.location !== booking.location;
|
||||
const shouldUpdateBookingReferences =
|
||||
!!changedOrganizer || isLocationChanged || !!isBookingRequestedReschedule;
|
||||
|
||||
if (evt.requiresConfirmation) {
|
||||
log.debug("RescheduleRequiresConfirmation: Deleting Event and Meeting for previous booking");
|
||||
@@ -525,7 +528,7 @@ export default class EventManager {
|
||||
updatedBookingReferences.push(...createdEvent.referencesToCreate);
|
||||
} else {
|
||||
// If the reschedule doesn't require confirmation, we can "update" the events and meetings to new time.
|
||||
if (isLocationChanged) {
|
||||
if (isLocationChanged || isBookingRequestedReschedule) {
|
||||
const updatedLocation = await this.updateLocation(evt, booking);
|
||||
results.push(...updatedLocation.results);
|
||||
updatedBookingReferences.push(...updatedLocation.referencesToCreate);
|
||||
@@ -577,8 +580,7 @@ export default class EventManager {
|
||||
|
||||
return {
|
||||
results,
|
||||
referencesToCreate:
|
||||
changedOrganizer || isLocationChanged ? updatedBookingReferences : [...booking.references],
|
||||
referencesToCreate: shouldUpdateBookingReferences ? updatedBookingReferences : [...booking.references],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -251,7 +251,7 @@ export const requestRescheduleHandler = async ({ ctx, input }: RequestReschedule
|
||||
})
|
||||
);
|
||||
return calendar?.deleteEvent(bookingRef.uid, builder.calendarEvent, bookingRef.externalCalendarId);
|
||||
} else if (bookingRef.type.endsWith("_video") && bookingRef.type !== "daily_video") {
|
||||
} else if (bookingRef.type.endsWith("_video")) {
|
||||
return deleteMeeting(
|
||||
getDelegationCredentialOrRegularCredential({
|
||||
credentials,
|
||||
|
||||
Reference in New Issue
Block a user