Files
calendar/packages/features/ee/workflows/lib/allowDisablingStandardEmails.ts
T
36d8554fd5 disable standard confirmation emails if workflow exists (#8747)
* add switches to advanced even type settings

* only show switches when workflow is enabled

* check in event type update handler if user is allowed to disable standard emails

* don't send emails if disabled

* make sure emails can't be disabled if no workflow exist

* send workflow emails to all attendees

* code clean up

* add translations

* always send to all attendees when scheduling reminders

* change text

---------

Co-authored-by: CarinaWolli <wollencarina@gmail.com>
2023-05-09 17:08:14 +00:00

28 lines
828 B
TypeScript

import type { Workflow, WorkflowStep } from "@calcom/prisma/client";
import { WorkflowTriggerEvents } from "@calcom/prisma/client";
import { WorkflowActions } from "@calcom/prisma/enums";
export function allowDisablingHostConfirmationEmails(
workflows: (Workflow & {
steps: WorkflowStep[];
})[]
) {
return !!workflows.find(
(workflow) =>
workflow.trigger === WorkflowTriggerEvents.NEW_EVENT &&
!!workflow.steps.find((step) => step.action === WorkflowActions.EMAIL_HOST)
);
}
export function allowDisablingAttendeeConfirmationEmails(
workflows: (Workflow & {
steps: WorkflowStep[];
})[]
) {
return !!workflows.find(
(workflow) =>
workflow.trigger === WorkflowTriggerEvents.NEW_EVENT &&
!!workflow.steps.find((step) => step.action === WorkflowActions.EMAIL_ATTENDEE)
);
}