fix: processWorkflowStep format cal event (#23802)

* fix: processWorkflowStep format cal event

* chore: update platform libraries
This commit is contained in:
Lauris Skraucis
2025-09-12 18:27:37 +01:00
committed by GitHub
parent 1fee90322d
commit 794c99239a
4 changed files with 22 additions and 8 deletions
+1 -1
View File
@@ -38,7 +38,7 @@
"@axiomhq/winston": "^1.2.0",
"@calcom/platform-constants": "*",
"@calcom/platform-enums": "*",
"@calcom/platform-libraries": "npm:@calcom/platform-libraries@0.0.354",
"@calcom/platform-libraries": "npm:@calcom/platform-libraries@0.0.356",
"@calcom/platform-types": "*",
"@calcom/platform-utils": "*",
"@calcom/prisma": "*",
@@ -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;
};
+5 -5
View File
@@ -2715,7 +2715,7 @@ __metadata:
"@axiomhq/winston": ^1.2.0
"@calcom/platform-constants": "*"
"@calcom/platform-enums": "*"
"@calcom/platform-libraries": "npm:@calcom/platform-libraries@0.0.354"
"@calcom/platform-libraries": "npm:@calcom/platform-libraries@0.0.356"
"@calcom/platform-types": "*"
"@calcom/platform-utils": "*"
"@calcom/prisma": "*"
@@ -3775,13 +3775,13 @@ __metadata:
languageName: unknown
linkType: soft
"@calcom/platform-libraries@npm:@calcom/platform-libraries@0.0.354":
version: 0.0.354
resolution: "@calcom/platform-libraries@npm:0.0.354"
"@calcom/platform-libraries@npm:@calcom/platform-libraries@0.0.356":
version: 0.0.356
resolution: "@calcom/platform-libraries@npm:0.0.356"
dependencies:
"@calcom/features": "*"
"@calcom/lib": "*"
checksum: 672e2567bf95692152b873688ff1a2e03401d622c3cb8410d518138893288776670d1dc5fdbe89a08d3326c3d41c081f0b70cf9f7bdc97b9a5229b9c80a2f817
checksum: dabce8a4add6c8082f06168ce9fbfef9be258f8ac3c60cb81e1985b4b49e2503f0f539dda9faf371bd1c79133419aed36d0ff849b6a2ecca77e7854752d8c97d
languageName: node
linkType: hard