fix: handle collective multiple host on destinationCalendar#8
Conversation
Codoki PR ReviewSummary: Support multiple destination calendars, update types Issues (Critical & High only)
Showing top 2 issues. Critical: 0, High: 2. See inline suggestions for more. Key Feedback (click to expand)
Confidence: 3/5 — Needs work before merge (2 high · status: Requires changes · scope: large PR (22 files)) React with 👍 or 👎 if you found this review useful. |
| // Fallback to Cal Video if Google Meet is selected w/o a Google Cal | ||
| if (evt.location === MeetLocationType && evt.destinationCalendar?.integration !== "google_calendar") { | ||
| // @NOTE: destinationCalendar it's an array now so as a fallback we will only check the first one | ||
| const [mainHostDestinationCalendar] = evt.destinationCalendar ?? []; |
There was a problem hiding this comment.
| const [mainHostDestinationCalendar] = evt.destinationCalendar ?? []; | |
| if (evt.location === MeetLocationType && (mainHostDestinationCalendar?.integration !== "google_calendar")) { | |
| evt["location"] = "integrations:daily"; | |
| } |
| @@ -244,7 +253,7 @@ export default class GoogleCalendarService implements Calendar { | |||
|
|
|||
There was a problem hiding this comment.
| const [mainHostDestinationCalendar] = event.destinationCalendar ?? []; | |
| const selectedCalendar = externalCalendarId || mainHostDestinationCalendar?.externalId || "primary"; |
| calendarReference = newBooking?.references.length | ||
| ? newBooking.references.find((reference) => reference.type.includes("_calendar")) | ||
| : booking.references.find((reference) => reference.type.includes("_calendar")); | ||
| ? newBooking.references.filter((reference) => reference.type.includes("_calendar")) |
There was a problem hiding this comment.
🔷 Medium: updateAllCalendarEvents builds an array of Promises via result.push(updateEvent(...)) but does not clearly await them before returning; this can lead to unhandled promise behavior and incomplete updates. Ensure the function returns Promise.all(result) to resolve all update operations.
| attendees: attendeesList, | ||
| uid: booking.uid, | ||
| recurringEvent: parseRecurringEvent(booking.eventType?.recurringEvent), | ||
| destinationCalendar: booking.destinationCalendar || user.destinationCalendar, |
There was a problem hiding this comment.
🔷 Medium: Changing the empty case to [] alters truthiness (an empty array is truthy), which can cause downstream checks like if (evt.destinationCalendar) to behave as if a calendar is present. To avoid subtle bugs across consumers, return null when there is no destination calendar or ensure all consumers check .length > 0.
| destinationCalendar: booking.destinationCalendar || user.destinationCalendar, | |
| destinationCalendar: selectedDestinationCalendar ? [selectedDestinationCalendar] : null, |
No description provided.