fix START_TIME variable + allow sms for self hosted (#8762)

Co-authored-by: CarinaWolli <[email protected]>
This commit is contained in:
Carina WollendorferandCarinaWolli authored and GitHub committed 2023-05-09 07:50:17 +00:00
1 parent af7d7ec678
commit fbbcc401cb
3 files changed
+11 -5

No files matched your search

@@ -9,7 +9,7 @@ import {
deleteScheduledSMSReminder,
scheduleSMSReminder,
} from "@calcom/features/ee/workflows/lib/reminders/smsReminderManager";
import { SENDER_ID, SENDER_NAME } from "@calcom/lib/constants";
import { IS_SELF_HOSTED, SENDER_ID, SENDER_NAME } from "@calcom/lib/constants";
import type { PrismaClient } from "@calcom/prisma/client";
import { BookingStatus, WorkflowActions, WorkflowMethods, WorkflowTriggerEvents } from "@calcom/prisma/enums";
import type { TrpcSessionUser } from "@calcom/trpc/server/trpc";
@@ -333,7 +333,8 @@ export const updateHandler = async ({ ctx, input }: UpdateOptions) => {
!userWorkflow.teamId &&
!userWorkflow.user?.teams.length &&
!isSMSAction(oldStep.action) &&
isSMSAction(newStep.action)
isSMSAction(newStep.action) &&
!IS_SELF_HOSTED
) {
throw new TRPCError({ code: "UNAUTHORIZED" });
}
@@ -487,7 +488,7 @@ export const updateHandler = async ({ ctx, input }: UpdateOptions) => {
//added steps
const addedSteps = steps.map((s) => {
if (s.id <= 0) {
if (!userWorkflow.user?.teams.length && isSMSAction(s.action)) {
if (!userWorkflow.user?.teams.length && isSMSAction(s.action) && !IS_SELF_HOSTED) {
throw new TRPCError({ code: "UNAUTHORIZED" });
}
const { id: _stepId, ...stepToAdd } = s;