Fix/workflow email (#6069)

* teams plan needed

* disable

* disable

* type fix

Co-authored-by: CarinaWolli <wollencarina@gmail.com>
This commit is contained in:
Carina Wollendorfer
2022-12-16 21:11:08 +00:00
committed by GitHub
co-authored by CarinaWolli
parent df0a522656
commit fd37397e5c
3 changed files with 4 additions and 13 deletions
@@ -39,6 +39,7 @@ export const scheduleEmailReminder = async (
workflowStepId: number,
template: WorkflowTemplates
) => {
if (action === WorkflowActions.EMAIL_ADDRESS) return;
const { startTime, endTime } = evt;
const uid = evt.uid as string;
const currentDate = dayjs();
@@ -76,10 +77,6 @@ export const scheduleEmailReminder = async (
attendeeName = evt.organizer.name;
timeZone = evt.attendees[0].timeZone;
break;
case WorkflowActions.EMAIL_ADDRESS:
name = "";
attendeeName = evt.attendees[0].name;
timeZone = evt.organizer.timeZone;
}
let emailContent = {
@@ -58,8 +58,7 @@ export const scheduleWorkflowReminders = async (
);
} else if (
step.action === WorkflowActions.EMAIL_ATTENDEE ||
step.action === WorkflowActions.EMAIL_HOST ||
step.action === WorkflowActions.EMAIL_ADDRESS
step.action === WorkflowActions.EMAIL_HOST
) {
let sendTo = "";
@@ -70,8 +69,6 @@ export const scheduleWorkflowReminders = async (
case WorkflowActions.EMAIL_ATTENDEE:
sendTo = evt.attendees[0].email;
break;
case WorkflowActions.EMAIL_ADDRESS:
sendTo = step.sendTo || "";
}
scheduleEmailReminder(
evt,
@@ -129,8 +126,7 @@ export const sendCancelledReminders = async (
);
} else if (
step.action === WorkflowActions.EMAIL_ATTENDEE ||
step.action === WorkflowActions.EMAIL_HOST ||
step.action === WorkflowActions.EMAIL_ADDRESS
step.action === WorkflowActions.EMAIL_HOST
) {
let sendTo = "";
@@ -141,8 +137,6 @@ export const sendCancelledReminders = async (
case WorkflowActions.EMAIL_ATTENDEE:
sendTo = evt.attendees[0].email;
break;
case WorkflowActions.EMAIL_ADDRESS:
sendTo = step.sendTo || "";
}
scheduleEmailReminder(
evt,
@@ -884,7 +884,7 @@ export const workflowsRouter = router({
throw new TRPCError({ code: "UNAUTHORIZED" });
}
if (isSMSAction(step.action)) {
if (isSMSAction(step.action) || step.action === WorkflowActions.EMAIL_ADDRESS) {
const hasTeamPlan = (await ctx.prisma.membership.count({ where: { userId: user.id } })) > 0;
if (!hasTeamPlan) {
throw new TRPCError({ code: "UNAUTHORIZED", message: "Team plan needed" });