Only update calendars on reschedule if there is a calendar reference

pull/7270/head
Joe Au-Yeung 2023-02-18 15:34:08 -05:00
parent d128c3ebb8
commit d05fe6f9b8
1 changed files with 7 additions and 5 deletions

View File

@ -1,7 +1,7 @@
import { DestinationCalendar } from "@prisma/client";
import type { DestinationCalendar } from "@prisma/client";
import merge from "lodash/merge";
import { v5 as uuidv5 } from "uuid";
import { z } from "zod";
import type { z } from "zod";
import { FAKE_DAILY_CREDENTIAL } from "@calcom/app-store/dailyvideo/lib/VideoApiAdapter";
import { getEventLocationTypeFromApp } from "@calcom/app-store/locations";
@ -10,7 +10,7 @@ import getApps from "@calcom/app-store/utils";
import prisma from "@calcom/prisma";
import { createdEventSchema } from "@calcom/prisma/zod-utils";
import type { AdditionalInformation, CalendarEvent, NewCalendarEventType } from "@calcom/types/Calendar";
import { CredentialPayload, CredentialWithAppName } from "@calcom/types/Credential";
import type { CredentialPayload, CredentialWithAppName } from "@calcom/types/Credential";
import type { Event } from "@calcom/types/Event";
import type {
CreateUpdateResult,
@ -255,8 +255,10 @@ export default class EventManager {
results.push(result);
}
// Update all calendar events.
results.push(...(await this.updateAllCalendarEvents(evt, booking)));
// If there is a calendar reference, update all calendar events.
if (booking.references.some((reference) => reference.type.includes("_calendar"))) {
results.push(...(await this.updateAllCalendarEvents(evt, booking)));
}
const bookingPayment = booking?.payment;