From 0b7e3510a53e7346b2730f7c1cbcd2f32f0f0378 Mon Sep 17 00:00:00 2001 From: Vijay Date: Sat, 23 Sep 2023 04:43:17 +0530 Subject: [PATCH] fix: #11397 request for reschedule did not cancel initial meeting (#11411) --- packages/core/videoClient.ts | 2 +- .../routers/viewer/bookings/requestReschedule.handler.ts | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/core/videoClient.ts b/packages/core/videoClient.ts index 7b48900d7d..425224fdd8 100644 --- a/packages/core/videoClient.ts +++ b/packages/core/videoClient.ts @@ -149,7 +149,7 @@ const updateMeeting = async ( }; }; -const deleteMeeting = async (credential: CredentialPayload, uid: string): Promise => { +const deleteMeeting = async (credential: CredentialPayload | null, uid: string): Promise => { if (credential) { const videoAdapter = (await getVideoAdapters([credential]))[0]; logger.debug("videoAdapter inside deleteMeeting", { credential, uid }); diff --git a/packages/trpc/server/routers/viewer/bookings/requestReschedule.handler.ts b/packages/trpc/server/routers/viewer/bookings/requestReschedule.handler.ts index 7d1de17503..ca282c9d4c 100644 --- a/packages/trpc/server/routers/viewer/bookings/requestReschedule.handler.ts +++ b/packages/trpc/server/routers/viewer/bookings/requestReschedule.handler.ts @@ -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 + ); } }) );