Scheduling infrastructure for absolutely everyone.
fix: use actual event duration mins for templated event names (#21263)
Jamie85b978226452
diff --git a/apps/web/modules/bookings/views/bookings-single-view.tsx b/apps/web/modules/bookings/views/bookings-single-view.tsxindex 2061efe6f72..c7d07a922d8 100644--- a/apps/web/modules/bookings/views/bookings-single-view.tsx+++ b/apps/web/modules/bookings/views/bookings-single-view.tsx@@ -236,6 +236,7 @@ export default function Success(props: PageProps) {if (eventType.isDynamic && bookingInfo.responses?.title) {evtName = bookingInfo.responses.title as string;}+const eventNameObject = {attendeeName: bookingInfo.responses.name as z.infer<typeof nameObjectSchema> | string,eventType: eventType.title,@@ -243,7 +244,7 @@ export default function Success(props: PageProps) {host: props.profile.name || "Nameless",location: location,bookingFields: bookingInfo.responses,- eventDuration: eventType.length,+ eventDuration: dayjs(bookingInfo.endTime).diff(bookingInfo.startTime, "minutes"),t,};diff --git a/packages/emails/email-manager.ts b/packages/emails/email-manager.tsindex 41cdc075566..fb834f071b8 100644--- a/packages/emails/email-manager.ts+++ b/packages/emails/email-manager.ts@@ -2,6 +2,7 @@ import type { TFunction } from "i18next";import { default as cloneDeep } from "lodash/cloneDeep";import type { z } from "zod";+import dayjs from "@calcom/dayjs";import type BaseEmail from "@calcom/emails/templates/_base-email";import type { EventNameObjectType } from "@calcom/lib/event";import { getEventName } from "@calcom/lib/event";@@ -450,7 +451,7 @@ export const sendCancelledEmailsAndSMS = async (const calendarEvent = formatCalEvent(calEvent);const emailsToSend: Promise<unknown>[] = [];const calEventLength = calendarEvent.length;- const eventDuration = calEventLength as number;+ const eventDuration = dayjs(calEvent.endTime).diff(calEvent.startTime, "minutes");if (typeof calEventLength !== "number") {logger.error(diff --git a/packages/features/bookings/lib/handleNewBooking.ts b/packages/features/bookings/lib/handleNewBooking.tsindex 20efcb75121..0eb12be1107 100644--- a/packages/features/bookings/lib/handleNewBooking.ts+++ b/packages/features/bookings/lib/handleNewBooking.ts@@ -969,7 +969,7 @@ async function handler(// TODO: Can we have an unnamed organizer? If not, I would really like to throw an error here.host: organizerUser.name || "Nameless",location: bookingLocation,- eventDuration: eventType.length,+ eventDuration: dayjs(reqBody.end).diff(reqBody.start, "minutes"),bookingFields: { ...responses },t: tOrganizer,};diff --git a/packages/features/ee/round-robin/roundRobinManualReassignment.ts b/packages/features/ee/round-robin/roundRobinManualReassignment.tsindex d662fa16ae1..5f2a39c1c4f 100644--- a/packages/features/ee/round-robin/roundRobinManualReassignment.ts+++ b/packages/features/ee/round-robin/roundRobinManualReassignment.ts@@ -169,7 +169,7 @@ export const roundRobinManualReassignment = async ({host: newUser.name || "Nameless",location: bookingLocation || "integrations:daily",bookingFields: { ...responses },- eventDuration: eventType.length,+ eventDuration: dayjs(booking.endTime).diff(booking.startTime, "minutes"),t: newUserT,});diff --git a/packages/features/ee/round-robin/roundRobinReassignment.ts b/packages/features/ee/round-robin/roundRobinReassignment.tsindex da2be635920..c320a4c4dd2 100644--- a/packages/features/ee/round-robin/roundRobinReassignment.ts+++ b/packages/features/ee/round-robin/roundRobinReassignment.ts@@ -232,7 +232,7 @@ export const roundRobinReassignment = async ({host: organizer.name || "Nameless",location: bookingLocation || "integrations:daily",bookingFields: { ...responses },- eventDuration: eventType.length,+ eventDuration: dayjs(booking.endTime).diff(booking.startTime, "minutes"),t: organizerT,};diff --git a/packages/lib/bookings/getCalendarLinks.ts b/packages/lib/bookings/getCalendarLinks.tsindex 746cc0aaa5e..ef63dd7e941 100644--- a/packages/lib/bookings/getCalendarLinks.ts+++ b/packages/lib/bookings/getCalendarLinks.ts@@ -178,7 +178,7 @@ export const getCalendarLinks = ({host: eventType.team?.name || eventType.users[0]?.name || "Nameless",location: booking.location,bookingFields: booking.responses,- eventDuration: eventType.length,+ eventDuration: dayjs(booking.endTime).diff(booking.startTime, "minutes"),t,};