Scheduling infrastructure for absolutely everyone.
Fixes google meet url not appearing calendar invite (#2636)
sean-brydon3256d601dbee
diff --git a/packages/app-store/googlecalendar/lib/CalendarService.ts b/packages/app-store/googlecalendar/lib/CalendarService.tsindex 1e742aa35cb..20fd3acc7af 100644--- a/packages/app-store/googlecalendar/lib/CalendarService.ts+++ b/packages/app-store/googlecalendar/lib/CalendarService.ts@@ -72,21 +72,21 @@ export default class GoogleCalendarService implements Calendar {};};- async createEvent(event: CalendarEvent): Promise<NewCalendarEventType> {+ async createEvent(calEventRaw: CalendarEvent): Promise<NewCalendarEventType> {return new Promise((resolve, reject) =>this.auth.getToken().then((myGoogleAuth) => {const payload: calendar_v3.Schema$Event = {- summary: event.title,- description: getRichDescription(event),+ summary: calEventRaw.title,+ description: getRichDescription(calEventRaw),start: {- dateTime: event.startTime,- timeZone: event.organizer.timeZone,+ dateTime: calEventRaw.startTime,+ timeZone: calEventRaw.organizer.timeZone,},end: {- dateTime: event.endTime,- timeZone: event.organizer.timeZone,+ dateTime: calEventRaw.endTime,+ timeZone: calEventRaw.organizer.timeZone,},- attendees: event.attendees.map((attendee) => ({+ attendees: calEventRaw.attendees.map((attendee) => ({...attendee,responseStatus: "accepted",})),@@ -95,23 +95,21 @@ export default class GoogleCalendarService implements Calendar {},};- if (event.location) {- payload["location"] = getLocation(event);+ if (calEventRaw.location) {+ payload["location"] = getLocation(calEventRaw);}- if (event.conferenceData && event.location === "integrations:google:meet") {- payload["conferenceData"] = event.conferenceData;+ if (calEventRaw.conferenceData && calEventRaw.location === "integrations:google:meet") {+ payload["conferenceData"] = calEventRaw.conferenceData;}-const calendar = google.calendar({version: "v3",- auth: myGoogleAuth,});calendar.events.insert({auth: myGoogleAuth,- calendarId: event.destinationCalendar?.externalId- ? event.destinationCalendar.externalId+ calendarId: calEventRaw.destinationCalendar?.externalId+ ? calEventRaw.destinationCalendar.externalId: "primary",requestBody: payload,conferenceDataVersion: 1,@@ -121,6 +119,22 @@ export default class GoogleCalendarService implements Calendar {console.error("There was an error contacting google calendar service: ", err);return reject(err);}++ calendar.events.patch({+ // Update the same event but this time we know the hangout link+ calendarId: calEventRaw.destinationCalendar?.externalId+ ? calEventRaw.destinationCalendar.externalId+ : "primary",+ auth: myGoogleAuth,+ eventId: event.data.id || "",+ requestBody: {+ description: getRichDescription({+ ...calEventRaw,+ additionInformation: { hangoutLink: event.data.hangoutLink || "" },+ }),+ },+ });+return resolve({uid: "",...event.data,