fix: #11397 request for reschedule did not cancel initial meeting (#11411)

This commit is contained in:
Vijay
2023-09-22 19:13:17 -04:00
committed by GitHub
parent e0c87cf664
commit 0b7e3510a5
2 changed files with 8 additions and 3 deletions
+1 -1
View File
@@ -149,7 +149,7 @@ const updateMeeting = async (
};
};
const deleteMeeting = async (credential: CredentialPayload, uid: string): Promise<unknown> => {
const deleteMeeting = async (credential: CredentialPayload | null, uid: string): Promise<unknown> => {
if (credential) {
const videoAdapter = (await getVideoAdapters([credential]))[0];
logger.debug("videoAdapter inside deleteMeeting", { credential, uid });
@@ -205,10 +205,15 @@ export const requestRescheduleHandler = async ({ ctx, input }: RequestReschedule
if (!bookingRef.uid) return;
if (bookingRef.type.endsWith("_calendar")) {
const calendar = await getCalendar(credentialsMap.get(bookingRef.type));
const calendar = await getCalendar(
credentials.find((cred) => cred.id === bookingRef?.credentialId) || null
);
return calendar?.deleteEvent(bookingRef.uid, builder.calendarEvent, bookingRef.externalCalendarId);
} else if (bookingRef.type.endsWith("_video")) {
return deleteMeeting(credentialsMap.get(bookingRef.type), bookingRef.uid);
return deleteMeeting(
credentials.find((cred) => cred?.id === bookingRef?.credentialId) || null,
bookingRef.uid
);
}
})
);