More fixes discovered during review

pull/6560/head
Hariom Balhara 2023-02-13 12:02:41 +05:30
parent d16d00fe07
commit c232f7acfc
7 changed files with 22 additions and 20 deletions

View File

@ -92,7 +92,7 @@ const widgets: Widgets & { [key in keyof Widgets]: Widgets[key] & { type: string
if (!props) {
return <div />;
}
// TODO: Use EmailField component
// TODO: Use EmailField component for Routing Form Email field
return <TextWidget type="email" {...props} />;
},
},

View File

@ -4,10 +4,7 @@ import {
ButtonProps,
ConjsProps,
FieldProps,
NumberWidgetProps,
ProviderProps,
SelectWidgetProps,
TextWidgetProps,
} from "react-awesome-query-builder";
import { Button as CalButton, Input, SelectWithValidation as Select, TextArea, TextField } from "@calcom/ui";
@ -82,7 +79,7 @@ const TextAreaWidget = (props: TextLikeComponentPropsRAQB) => {
const textValue = value || "";
return (
<TextArea
<textarea
value={textValue}
placeholder={placeholder}
disabled={readOnly}

View File

@ -230,8 +230,7 @@ export const useIsEmbed = (embedSsr?: boolean) => {
const _isValidNamespace = isValidNamespace(namespace);
if (parent !== window && !_isValidNamespace) {
log(
`Looks like you have iframed cal.com but not using Embed Snippet.
Directly using an iframe isn't recommended.`
`Looks like you have iframed cal.com but not using Embed Snippet. Directly using an iframe isn't recommended.`
);
}
setIsEmbed(window?.isEmbed?.() || false);

View File

@ -62,7 +62,7 @@ export const ensureBookingInputsHaveSystemFields = ({
additionalNotesRequired: boolean;
customInputs: z.infer<typeof customInputSchema>[];
}) => {
// If bookingFields is set already, the migration is done. The very first time for an EventType bookingFields would be empty
// If bookingFields is set already, the migration is done.
const handleMigration = !bookingFields.length;
const CustomInputTypeToFieldType = {
[EventTypeCustomInputType.TEXT]: BookingFieldType.text,
@ -189,7 +189,7 @@ export const ensureBookingInputsHaveSystemFields = ({
bookingFields = missingSystemBeforeFields.concat(bookingFields);
// If we are migrating from old system, we need to add custom inputs to the end of the list
// Backward Compatibility: If we are migrating from old system, we need to map `customInputs` to `bookingFields`
if (handleMigration) {
customInputs.forEach((input) => {
bookingFields.push({
@ -201,13 +201,13 @@ export const ensureBookingInputsHaveSystemFields = ({
type: CustomInputTypeToFieldType[input.type],
required: input.required,
options: input.options
? input.options.reduce((newOptions, o) => {
newOptions.push({
? input.options.map((o) => {
return {
...o,
value: `${newOptions.length + 1}`,
});
return newOptions;
}, [] as NonNullable<Fields[number]["options"]>)
// Send the label as the value without any trimming or lowercase as this is what customInput are doing. It maintains backward compatibility
value: o.label,
};
})
: [],
});
});
@ -228,8 +228,7 @@ export const ensureBookingInputsHaveSystemFields = ({
if (!foundEditableMap) {
return field;
}
// Ensure that system fields editability, even if modified to something else, get's reset to what's in the code.
// This allows us to change the editability of any system field easily in future
// Ensure that system fields editability, even if modified to something else in DB(accidentally), get's reset to what's in the code.
return {
...field,
editable: foundEditableMap,

View File

@ -54,8 +54,6 @@ const WorkflowListItem = (props: ItemProps) => {
offOn = "on";
}
await utils.viewer.eventTypes.get.invalidate({ id: eventType.id });
await utils.viewer.eventTypes.get.invalidate();
await utils.viewer.eventTypes.getByViewer.invalidate();
showToast(
t("workflow_turned_on_successfully", {
workflowName: workflow.name,

View File

@ -176,7 +176,12 @@ export const FormBuilder = function FormBuilder({
required
value={option.label}
onChange={(e) => {
value.splice(index, 1, { label: e.target.value, value: e.target.value.trim() });
// Right now we use label of the option as the value of the option. It allows us to not separately lookup the optionId to know the optionValue
// It has the same drawback that if the label is changed, the value of the option will change. It is not a big deal for now.
value.splice(index, 1, {
label: e.target.value,
value: e.target.value.toLowerCase().trim(),
});
onChange(value);
}}
readOnly={readOnly}

View File

@ -156,7 +156,11 @@ export interface CalendarEvent {
appsStatus?: AppsStatus[];
seatsShowAttendees?: boolean | null;
seatsPerTimeSlot?: number | null;
// It has responses to all the fields(system + user)
responses?: Prisma.JsonObject | null;
// It maps to customInputs to get access to only the user fields. It allows to easily iterate over to show only user fields
userFieldsResponses?: Prisma.JsonObject | null;
}