From eefb829f7548de183099d9fdfb185a81a7cfa677 Mon Sep 17 00:00:00 2001 From: Alex van Andel Date: Fri, 29 Oct 2021 09:21:32 +0100 Subject: [PATCH] Fixes #1021 - correctly replace integrations:google:meet (#1071) --- lib/events/EventManager.ts | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/lib/events/EventManager.ts b/lib/events/EventManager.ts index 97ef3946..e0be3109 100644 --- a/lib/events/EventManager.ts +++ b/lib/events/EventManager.ts @@ -82,8 +82,8 @@ export default class EventManager { let evt = EventManager.processLocation(event); const isDedicated = evt.location ? EventManager.isDedicatedIntegration(evt.location) : null; - let results: Array = []; - + // First, create all calendar events. If this is a dedicated integration event, don't send a mail right here. + const results: Array = await this.createAllCalendarEvents(evt, isDedicated); // If and only if event type is a dedicated meeting, create a dedicated video meeting. if (isDedicated) { const result = await this.createVideoEvent(evt); @@ -95,10 +95,6 @@ export default class EventManager { await EventManager.sendAttendeeMail("new", results, evt); } - // Now create all calendar events. If this is a dedicated integration event, - // don't send a mail right here, because it has already been sent. - results = results.concat(await this.createAllCalendarEvents(evt, isDedicated)); - const referencesToCreate: Array = results.map((result: EventResult) => { let uid = ""; if (result.createdEvent) { @@ -162,9 +158,8 @@ export default class EventManager { } const isDedicated = evt.location ? EventManager.isDedicatedIntegration(evt.location) : null; - - let results: Array = []; - + // First, create all calendar events. If this is a dedicated integration event, don't send a mail right here. + const results: Array = await this.updateAllCalendarEvents(evt, booking, isDedicated); // If and only if event type is a dedicated meeting, update the dedicated video meeting. if (isDedicated) { const result = await this.updateVideoEvent(evt, booking); @@ -175,11 +170,6 @@ export default class EventManager { } else { await EventManager.sendAttendeeMail("reschedule", results, evt); } - - // Now update all calendar events. If this is a dedicated integration event, - // don't send a mail right here, because it has already been sent. - results = results.concat(await this.updateAllCalendarEvents(evt, booking, isDedicated)); - // Now we can delete the old booking and its references. const bookingReferenceDeletes = prisma.bookingReference.deleteMany({ where: {