fix: use actual event duration mins for templated event names (#21263)

* fix: use actual event duration mins for templated names

* fix: use actual event duration mins for templated event name

* fix: use actual event duration for calendar links

* fix: use actual event duration for round robin reassignment

* chore: rm console logs

* fix: use actual event duration for emails and rr reassignment

* chore: remove unnecessary dayjs calls

---------

Co-authored-by: Tushar Bhatt <95581504+TusharBhatt1@users.noreply.github.com>
This commit is contained in:
JamieandTushar Bhatt authored and GitHub committed 2025-05-13 18:51:43 +00:00
1 parent c2b091aa67
commit 85b9782264
6 files changed
+8 -6

No files matched your search

@@ -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,
};
+2 -1
View File
@@ -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(
@@ -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,
};
@@ -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,
});
@@ -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,
};
+1 -1
View File
@@ -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,
};