* 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>
28 lines
828 B
TypeScript
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)
|
|
);
|
|
}
|