Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: reschedule with google meet #14730

Merged
merged 16 commits into from May 7, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 12 additions & 9 deletions packages/features/bookings/lib/handleNewBooking.ts
Expand Up @@ -1856,7 +1856,10 @@ async function handler(
});
}

if (googleCalResult?.createdEvent?.hangoutLink) {
const googleHangoutLink =
googleCalResult?.createdEvent?.hangoutLink ?? googleCalResult?.updatedEvent?.hangoutLink;

if (googleHangoutLink) {
results.push({
...googleMeetResult,
success: true,
Expand All @@ -1865,31 +1868,31 @@ async function handler(
// Add google_meet to referencesToCreate in the same index as google_calendar
updateManager.referencesToCreate[googleCalIndex] = {
...updateManager.referencesToCreate[googleCalIndex],
meetingUrl: googleCalResult.createdEvent.hangoutLink,
meetingUrl: googleHangoutLink,
};

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

metadata.hangoutLink = results[0].createdEvent?.hangoutLink;
metadata.conferenceData = results[0].createdEvent?.conferenceData;
metadata.entryPoints = results[0].createdEvent?.entryPoints;
const createdOrUpdatedEvent = results[0]?.createdEvent ?? results[0].updatedEvent;
metadata.hangoutLink = createdOrUpdatedEvent?.hangoutLink;
metadata.conferenceData = createdOrUpdatedEvent?.conferenceData;
metadata.entryPoints = createdOrUpdatedEvent?.entryPoints;
evt.appsStatus = handleAppsStatus(results, booking, reqAppsStatus);
videoCallUrl =
metadata.hangoutLink ||
results[0].createdEvent?.url ||
createdOrUpdatedEvent?.url ||
organizerOrFirstDynamicGroupMemberDefaultLocationUrl ||
getVideoCallUrlFromCalEvent(evt) ||
videoCallUrl;
Expand Down