Skip to content

Scheduling infrastructure for absolutely everyone.

fix: zoom shows up as location when expired instead of cal (#15153)

Shaik-Sirajuddinf897c680a412
diff --git a/packages/core/EventManager.ts b/packages/core/EventManager.ts
index 955ef445545..82cd50a2888 100644
--- a/packages/core/EventManager.ts
+++ b/packages/core/EventManager.ts
@@ -163,6 +163,13 @@ export default class EventManager {
evt.videoCallData = result.createdEvent;
evt.location = result.originalEvent.location;
result.type = result.createdEvent.type;
+ //responses data is later sent to webhook
+ if (evt.location && evt.responses) {
+ evt.responses["location"].value = {
+ optionValue: "",
+ value: evt.location,
+ };
+ }
}
results.push(result);
@@ -224,6 +231,15 @@ export default class EventManager {
const result = await this.createVideoEvent(evt);
if (result.createdEvent) {
evt.videoCallData = result.createdEvent;
+ evt.location = result.originalEvent.location;
+ result.type = result.createdEvent.type;
+ //responses data is later sent to webhook
+ if (evt.location && evt.responses) {
+ evt.responses["location"].value = {
+ optionValue: "",
+ value: evt.location,
+ };
+ }
}
results.push(result);
diff --git a/packages/core/videoClient.ts b/packages/core/videoClient.ts
index aa0cab0af55..8cfba66aee7 100644
--- a/packages/core/videoClient.ts
+++ b/packages/core/videoClient.ts
@@ -3,6 +3,7 @@ import { v5 as uuidv5 } from "uuid";
import appStore from "@calcom/app-store";
import { getDailyAppKeys } from "@calcom/app-store/dailyvideo/lib/getDailyAppKeys";
+import { DailyLocationType } from "@calcom/app-store/locations";
import { sendBrokenIntegrationEmail } from "@calcom/emails";
import { getUid } from "@calcom/lib/CalEventParser";
import logger from "@calcom/lib/logger";
@@ -114,14 +115,13 @@ const createMeeting = async (credential: CredentialPayload, calEvent: CalendarEv
safeStringify(err),
safeStringify({ calEvent: getPiiFreeCalendarEvent(calEvent) })
);
-
// Default to calVideo
const defaultMeeting = await createMeetingWithCalVideo(calEvent);
if (defaultMeeting) {
- calEvent.location = "integrations:dailyvideo";
+ calEvent.location = DailyLocationType;
}
- returnObject = { ...returnObject, createdEvent: defaultMeeting };
+ returnObject = { ...returnObject, originalEvent: calEvent, createdEvent: defaultMeeting };
}
return returnObject;
diff --git a/packages/features/bookings/lib/handleNewBooking.ts b/packages/features/bookings/lib/handleNewBooking.ts
index 4ab5fad3f5d..bb72f5600d8 100644
--- a/packages/features/bookings/lib/handleNewBooking.ts
+++ b/packages/features/bookings/lib/handleNewBooking.ts
@@ -2132,7 +2132,9 @@ async function handler(
} else if (isConfirmedByDefault) {
// Use EventManager to conditionally use all needed integrations.
const createManager = await eventManager.create(evt);
-
+ if (evt.location) {
+ booking.location = evt.location;
+ }
// This gets overridden when creating the event - to check if notes have been hidden or not. We just reset this back
// to the default description when we are sending the emails.
evt.description = eventType.description;
@@ -2488,6 +2490,7 @@ async function handler(
uid: booking.uid,
},
data: {
+ location: evt.location,
metadata: { ...(typeof booking.metadata === "object" && booking.metadata), ...metadata },
references: {
createMany: {
diff --git a/packages/features/bookings/lib/handleNewBooking/test/fresh-booking.test.ts b/packages/features/bookings/lib/handleNewBooking/test/fresh-booking.test.ts
index 90c0ce46338..b0d7027f3e7 100644
--- a/packages/features/bookings/lib/handleNewBooking/test/fresh-booking.test.ts
+++ b/packages/features/bookings/lib/handleNewBooking/test/fresh-booking.test.ts
@@ -1100,7 +1100,7 @@ describe("handleNewBooking", () => {
);
test(
- `Booking should still be created if booking with Zoom errors`,
+ `Booking should still be created using calvideo, if error occurs with zoom`,
async ({ emails }) => {
const handleNewBooking = (await import("@calcom/features/bookings/lib/handleNewBooking")).default;
const subscriberUrl = "http://my-webhook.example.com";
@@ -1132,7 +1132,7 @@ describe("handleNewBooking", () => {
],
},
],
- apps: [TestData.apps["zoomvideo"]],
+ apps: [TestData.apps["zoomvideo"], TestData.apps["daily-video"]],
webhooks: [
{
userId: organizer.id,
@@ -1150,6 +1150,15 @@ describe("handleNewBooking", () => {
metadataLookupKey: "zoomvideo",
});
+ mockSuccessfulVideoMeetingCreation({
+ metadataLookupKey: "dailyvideo",
+ videoMeetingData: {
+ id: "MOCK_ID",
+ password: "MOCK_PASS",
+ url: `http://mock-dailyvideo.example.com/meeting-1`,
+ },
+ });
+
const { req } = createMockNextJsRequest({
method: "POST",
body: getMockRequestDataForBooking({
@@ -1163,16 +1172,18 @@ describe("handleNewBooking", () => {
},
}),
});
- await handleNewBooking(req);
+ const createdBooking = await handleNewBooking(req);
+ expect(createdBooking).toContain({
+ location: BookingLocations.CalVideo,
+ });
expectBrokenIntegrationEmails({ organizer, emails });
-
expectBookingCreatedWebhookToHaveBeenFired({
booker,
organizer,
- location: BookingLocations.ZoomVideo,
+ location: BookingLocations.CalVideo,
subscriberUrl,
- videoCallUrl: null,
+ videoCallUrl: `${WEBAPP_URL}/video/${createdBooking.uid}`,
});
},
timeout
diff --git a/packages/features/bookings/lib/handleNewBooking/test/team-bookings/collective-scheduling.test.ts b/packages/features/bookings/lib/handleNewBooking/test/team-bookings/collective-scheduling.test.ts
index 3c974d3b98e..ecb09863940 100644
--- a/packages/features/bookings/lib/handleNewBooking/test/team-bookings/collective-scheduling.test.ts
+++ b/packages/features/bookings/lib/handleNewBooking/test/team-bookings/collective-scheduling.test.ts
@@ -1287,7 +1287,7 @@ describe("handleNewBooking", () => {
expectBookingCreatedWebhookToHaveBeenFired({
booker,
organizer,
- location: OrganizerDefaultConferencingAppType,
+ location: BookingLocations.CalVideo,
subscriberUrl: "http://my-webhook.example.com",
videoCallUrl: `${WEBAPP_URL}/video/${createdBooking.uid}`,
});