make SMS available for all users again (#5656)

Co-authored-by: CarinaWolli <[email protected]>
Co-authored-by: Omar López <[email protected]>
This commit is contained in:
authored and GitHub committed 2022-11-23 22:42:42 +00:00
1 parent 38d8852819
commit e3a7fd006b
4 files changed
+10 -40

No files matched your search

@@ -32,12 +32,6 @@ import { TRPCError } from "@trpc/server";
import { router, authedProcedure } from "../../trpc";
function isSMSAction(action: WorkflowActions) {
if (action === WorkflowActions.SMS_ATTENDEE || action === WorkflowActions.SMS_NUMBER) {
return true;
}
}
export const workflowsRouter = router({
list: authedProcedure.query(async ({ ctx }) => {
const workflows = await ctx.prisma.workflow.findMany({
@@ -524,9 +518,6 @@ export const workflowsRouter = router({
});
//step was edited
} else if (JSON.stringify(oldStep) !== JSON.stringify(newStep)) {
if (user.plan === "FREE" && !isSMSAction(oldStep.action) && isSMSAction(newStep.action)) {
throw new TRPCError({ code: "UNAUTHORIZED" });
}
await ctx.prisma.workflowStep.update({
where: {
id: oldStep.id,
@@ -666,9 +657,6 @@ export const workflowsRouter = router({
//added steps
const addedSteps = steps.map((s) => {
if (s.id <= 0) {
if (user.plan === "FREE" && isSMSAction(s.action)) {
throw new TRPCError({ code: "UNAUTHORIZED" });
}
const { id: stepId, ...stepToAdd } = s;
return stepToAdd;
}