From f9c578c87d30aa7058b2317dc6a1a736fbd0727b Mon Sep 17 00:00:00 2001 From: Alex van Andel Date: Fri, 6 Oct 2023 14:27:36 +0100 Subject: [PATCH] fix: Backwards compatibility on google reschedule/cancel (#11733) --- .../googlecalendar/lib/CalendarService.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/app-store/googlecalendar/lib/CalendarService.ts b/packages/app-store/googlecalendar/lib/CalendarService.ts index 12c5152396..fa7dec8e7a 100644 --- a/packages/app-store/googlecalendar/lib/CalendarService.ts +++ b/packages/app-store/googlecalendar/lib/CalendarService.ts @@ -284,9 +284,10 @@ export default class GoogleCalendarService implements Calendar { const calendar = await this.authedCalendar(); - const selectedCalendar = externalCalendarId - ? externalCalendarId - : event.destinationCalendar?.find((cal) => cal.externalId === externalCalendarId)?.externalId; + const selectedCalendar = + (externalCalendarId + ? event.destinationCalendar?.find((cal) => cal.externalId === externalCalendarId)?.externalId + : undefined) || "primary"; try { const evt = await calendar.events.update({ @@ -337,14 +338,15 @@ export default class GoogleCalendarService implements Calendar { async deleteEvent(uid: string, event: CalendarEvent, externalCalendarId?: string | null): Promise { const calendar = await this.authedCalendar(); - const defaultCalendarId = "primary"; - const calendarId = externalCalendarId - ? externalCalendarId - : event.destinationCalendar?.find((cal) => cal.externalId === externalCalendarId)?.externalId; + + const selectedCalendar = + (externalCalendarId + ? event.destinationCalendar?.find((cal) => cal.externalId === externalCalendarId)?.externalId + : undefined) || "primary"; try { const event = await calendar.events.delete({ - calendarId: calendarId ? calendarId : defaultCalendarId, + calendarId: selectedCalendar, eventId: uid, sendNotifications: false, sendUpdates: "none",