Fix rescheduling error with attendee phone number as location (#5657)

* only show smsReminder number if event type has SMS_ATTENDEE action

* fix rescheduling bug

* Change array iteration to only run for best scenario

Co-authored-by: CarinaWolli <wollencarina@gmail.com>
Co-authored-by: Alan <alannnc@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
pull/5656/head^2
Carina Wollendorfer 2022-11-23 23:30:54 +01:00 committed by GitHub
parent c0f34a39d1
commit 38d8852819
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 5 deletions

View File

@ -622,7 +622,7 @@ const BookingPage = ({
)}
</>
{/* TODO: Change name and id ="phone" to something generic */}
{AttendeeInput && (
{AttendeeInput && !disableInput && (
<div className="mb-4">
<label
htmlFor={
@ -659,7 +659,6 @@ const BookingPage = ({
: ""
}
required
disabled={disableInput}
/>
</div>
{bookingForm.formState.errors.phone && (

View File

@ -1,4 +1,4 @@
import { BookingStatus } from "@prisma/client";
import { BookingStatus, WorkflowActions } from "@prisma/client";
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@radix-ui/react-collapsible";
import classNames from "classnames";
import { createEvent } from "ics";
@ -298,6 +298,11 @@ export default function Success(props: SuccessProps) {
const locationToDisplay = getSuccessPageLocationMessage(location, t);
const hasSMSAttendeeAction =
eventType.workflows.find((workflowEventType) =>
workflowEventType.workflow.steps.find((step) => step.action === WorkflowActions.SMS_ATTENDEE)
) !== undefined;
return (
<div className={isEmbed ? "" : "h-screen"} data-testid="success-page">
{userIsOwner && !isEmbed && (
@ -452,7 +457,7 @@ export default function Success(props: SuccessProps) {
</>
);
})}
{bookingInfo?.smsReminderNumber && (
{bookingInfo?.smsReminderNumber && hasSMSAttendeeAction && (
<>
<div className="mt-9 font-medium">{t("number_sms_notifications")}</div>
<div className="col-span-2 mb-2 mt-9">
@ -777,6 +782,15 @@ const getEventTypesFromDB = async (id: number) => {
hideBranding: true,
},
},
workflows: {
select: {
workflow: {
select: {
steps: true,
},
},
},
},
metadata: true,
seatsPerTimeSlot: true,
seatsShowAttendees: true,

View File

@ -153,7 +153,7 @@ export const extendedBookingCreateBody = bookingCreateBodySchema.merge(
allRecurringDates: z.string().array().optional(),
currentRecurringIndex: z.number().optional(),
rescheduleReason: z.string().optional(),
smsReminderNumber: z.string().optional(),
smsReminderNumber: z.string().optional().nullable(),
appsStatus: z
.array(
z.object({