Skip to content

Commit

Permalink
Fix no video reference on google-meet (calcom#8849)
Browse files Browse the repository at this point in the history
  • Loading branch information
alannnc authored May 11, 2023
1 parent 4374da0 commit b44e5a7
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion packages/features/bookings/lib/handleNewBooking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1940,7 +1940,11 @@ async function handler(
originalEvent: results[0].originalEvent,
};

const googleCalResult = results.find((result) => result.type === "google_calendar");
// Find index of google_calendar inside createManager.referencesToCreate
const googleCalIndex = createManager.referencesToCreate.findIndex(
(ref) => ref.type === "google_calendar"
);
const googleCalResult = results[googleCalIndex];

if (!googleCalResult) {
results.push({
Expand All @@ -1955,6 +1959,20 @@ async function handler(
...googleMeetResult,
success: true,
});

// Add google_meet to referencesToCreate in the same index as google_calendar
createManager.referencesToCreate[googleCalIndex] = {
...createManager.referencesToCreate[googleCalIndex],
meetingUrl: googleCalResult.createdEvent.hangoutLink,
};

// Also create a new referenceToCreate with type video for google_meet
createManager.referencesToCreate.push({
type: "google_meet_video",
meetingUrl: googleCalResult.createdEvent.hangoutLink,
uid: googleCalResult.uid,
credentialId: createManager.referencesToCreate[googleCalIndex].credentialId,
});
} else if (googleCalResult && !googleCalResult.createdEvent?.hangoutLink) {
results.push({
...googleMeetResult,
Expand Down

0 comments on commit b44e5a7

Please sign in to comment.