fix: handle collective multiple host on destinationCalendar#4
Conversation
|
Thank you for following the naming conventions! 🙏 |
|
cursor review |
There was a problem hiding this comment.
Bugbot free trial expires on August 11, 2025
Learn more in the Cursor dashboard.
| 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 ?? []; | ||
| if (evt.location === MeetLocationType && mainHostDestinationCalendar.integration !== "google_calendar") { |
| ...(IS_TEAM_BILLING_ENABLED ? { slug } : {}), | ||
| metadata: { | ||
| ...(IS_TEAM_BILLING_ENABLED && { requestedSlug: slug }), | ||
| ...(IS_TEAM_BILLING_ENABLED ? { requestedSlug: slug } : {}), |
There was a problem hiding this comment.
Bug: Team Billing Logic Inversion
Logic inversion in organization creation: The slug property is now conditionally set when IS_TEAM_BILLING_ENABLED is true, instead of when it's false as originally intended. This change, combined with requestedSlug still being set when IS_TEAM_BILLING_ENABLED is true, results in both properties being set when billing is enabled, and neither when disabled. This completely reverses the original behavior and breaks organization creation logic.
| const calendarId = externalCalendarId ? externalCalendarId : event.destinationCalendar?.externalId; | ||
| const calendarId = externalCalendarId | ||
| ? externalCalendarId | ||
| : event.destinationCalendar?.find((cal) => cal.externalId === externalCalendarId)?.externalId; |
There was a problem hiding this comment.
Bug: Calendar ID Handling Fails on Falsy Values
The calendar ID selection logic in updateEvent and deleteEvent is flawed. When externalCalendarId is falsy (e.g., null or undefined), the code attempts to find a calendar where cal.externalId matches this falsy value. This find operation will never succeed for valid calendar entries, preventing the correct destination calendar from being selected and breaking the intended fallback behavior.
Locations (2)
| (c) => c.type === destination.integration | ||
| ); | ||
| createdEvents = createdEvents.concat( | ||
| await Promise.all(destinationCalendarCredentials.map(async (c) => await createEvent(c, event))) |
There was a problem hiding this comment.
|
This PR is being marked as stale due to inactivity. |
Test 4