disable emails to all guests (#18628)

Co-authored-by: CarinaWolli <wollencarina@gmail.com>
This commit is contained in:
Carina Wollendorfer
2025-01-13 15:58:43 +00:00
committed by GitHub
co-authored by CarinaWolli
parent 80aac06ff3
commit 68f76e2acc
@@ -6,6 +6,7 @@ import {
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 prisma from "@calcom/prisma";
import { SchedulingType, WorkflowActions, WorkflowTriggerEvents } from "@calcom/prisma/enums";
import type { CalendarEvent } from "@calcom/types/Calendar";
@@ -106,7 +107,25 @@ const processWorkflowStep = async (
? [emailAttendeeSendToOverride]
: evt.attendees?.map((attendee) => attendee.email);
sendTo = attendees;
const limitGuestsDate = new Date("2025-01-13");
if (workflow.userId) {
const user = await prisma.user.findFirst({
where: {
id: workflow.userId,
},
select: {
createdDate: true,
},
});
if (user?.createdDate && user.createdDate > limitGuestsDate) {
sendTo = attendees.slice(0, 1);
} else {
sendTo = attendees;
}
} else {
sendTo = attendees;
}
break;
}