fix: processWorkflowStep format cal event (#23802)

* fix: processWorkflowStep format cal event

* chore: update platform libraries
This commit is contained in:
Lauris Skraucis authored and GitHub committed 2025-09-12 18:27:37 +01:00
1 parent 1fee90322d
commit 794c99239a
4 files changed
+22 -8

No files matched your search

@@ -10,6 +10,7 @@ import * as twilio from "@calcom/features/ee/workflows/lib/reminders/providers/t
import type { Workflow, WorkflowStep } from "@calcom/features/ee/workflows/lib/types";
import { checkSMSRateLimit } from "@calcom/lib/checkRateLimitAndThrowError";
import { SENDER_NAME } from "@calcom/lib/constants";
import { formatCalEventExtended } from "@calcom/lib/formatCalendarEvent";
import { withReporting } from "@calcom/lib/sentryWrapper";
import { getTranslation } from "@calcom/lib/server/i18n";
import prisma from "@calcom/prisma";
@@ -53,7 +54,7 @@ const processWorkflowStep = async (
step: WorkflowStep,
{
smsReminderNumber,
calendarEvent: evt,
calendarEvent,
emailAttendeeSendToOverride,
hideBranding,
seatReferenceUid,
@@ -61,6 +62,8 @@ const processWorkflowStep = async (
) => {
if (!step?.verifiedAt) return;
const evt = formatCalEventExtended(calendarEvent);
if (isSMSOrWhatsappAction(step.action)) {
await checkSMSRateLimit({
identifier: `sms:${workflow.teamId ? "team:" : "user:"}${workflow.teamId || workflow.userId}`,
+12 -1
View File
@@ -1,10 +1,11 @@
// eslint-disable-next-line no-restricted-imports
import { cloneDeep } from "lodash";
import type { ExtendedCalendarEvent } from "@calcom/ee/workflows/lib/reminders/reminderScheduler";
import type { CalendarEvent } from "@calcom/types/Calendar";
// format CalEvent to remove platformClientId from email addresses
const formatClientIdFromEmails = (calEvent: CalendarEvent, clientId: string) => {
const formatClientIdFromEmails = (calEvent: CalendarEvent | ExtendedCalendarEvent, clientId: string) => {
const attendees = calEvent.attendees.map((attendee) => ({
...attendee,
email: attendee.email.replace(`+${clientId}`, ""),
@@ -25,3 +26,13 @@ export const formatCalEvent = (calEvent: CalendarEvent) => {
return clonedEvent;
};
export const formatCalEventExtended = (calEvent: ExtendedCalendarEvent) => {
const clonedEvent = cloneDeep(calEvent);
if (clonedEvent.platformClientId) {
const [attendees, organizer] = formatClientIdFromEmails(clonedEvent, clonedEvent.platformClientId);
Object.assign(clonedEvent, { attendees, organizer });
}
return clonedEvent;
};