Skip to content

Scheduling infrastructure for absolutely everyone.

Fixing GCal emailing notif and sequential deleting (#6460)

Leo Giovanettia4d6f7da6274
diff --git a/packages/app-store/googlecalendar/lib/CalendarService.ts b/packages/app-store/googlecalendar/lib/CalendarService.ts
index 9e516b05e3c..42c6a7c9161 100644
--- a/packages/app-store/googlecalendar/lib/CalendarService.ts
+++ b/packages/app-store/googlecalendar/lib/CalendarService.ts
@@ -273,7 +273,7 @@ export default class GoogleCalendarService implements Calendar {
auth: myGoogleAuth,
calendarId: calendarId ? calendarId : defaultCalendarId,
eventId: uid,
- sendNotifications: true,
+ sendNotifications: false,
sendUpdates: "all",
},
function (err: GoogleCalError | null, event) {
diff --git a/packages/features/bookings/lib/handleCancelBooking.ts b/packages/features/bookings/lib/handleCancelBooking.ts
index 99a41e8769e..0f877549731 100644
--- a/packages/features/bookings/lib/handleCancelBooking.ts
+++ b/packages/features/bookings/lib/handleCancelBooking.ts
@@ -306,15 +306,16 @@ async function handler(req: NextApiRequest & { userId?: number }) {
) {
bookingToDelete.user.credentials
.filter((credential) => credential.type.endsWith("_calendar"))
- .forEach((credential) => {
+ .forEach(async (credential) => {
const calendar = getCalendar(credential);
- updatedBookings.forEach((updBooking) => {
+ for (const updBooking of updatedBookings) {
const bookingRef = updBooking.references.find((ref) => ref.type.includes("_calendar"));
if (bookingRef) {
const { uid, externalCalendarId } = bookingRef;
- apiDeletes.push(calendar?.deleteEvent(uid, evt, externalCalendarId) as Promise<unknown>);
+ const deletedEvent = await calendar?.deleteEvent(uid, evt, externalCalendarId);
+ apiDeletes.push(deletedEvent);
}
- });
+ }
});
} else {
apiDeletes.push(calendar?.deleteEvent(uid, evt, externalCalendarId) as Promise<unknown>);