Enable to create/trigger webhooks with no events (#12174)

Co-authored-by: cyril lopez <cyril@strapi.io>
This commit is contained in:
Jean-Sébastien Herbaux 2022-01-12 16:26:06 +01:00 committed by GitHub
parent d8acb3df67
commit ce09d38972
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 24 deletions

View File

@ -63,7 +63,7 @@ const EventInput = ({ isDraftAndPublish }) => {
: displayedData.events.default;
const { formatMessage } = useIntl();
const { values, errors, handleChange: onChange } = useFormikContext();
const { values, handleChange: onChange } = useFormikContext();
const inputName = 'events';
const inputValue = values.events;
@ -100,7 +100,7 @@ const EventInput = ({ isDraftAndPublish }) => {
return (
<Stack size={1}>
<FieldLabel required>
<FieldLabel>
{formatMessage({
id: 'Settings.webhooks.form.events',
defaultMessage: 'Events',
@ -154,14 +154,6 @@ const EventInput = ({ isDraftAndPublish }) => {
})}
</tbody>
</StyledTable>
{errors.events && (
<Typography variant="pi" textColor="danger600" data-strapi-field-error>
{formatMessage({
id: 'components.Input.error.validation.required',
defaultMessage: 'This value is required',
})}
</Typography>
)}
</Stack>
);
};

View File

@ -29,10 +29,7 @@ const schema = yup.object().shape({
})
);
}),
events: yup
.array()
.min(1, translatedErrors.min)
.required(translatedErrors.required),
events: yup.array(),
});
export default schema;

View File

@ -28,16 +28,12 @@ const webhookValidator = yup
)
.required();
}),
events: yup
.array()
.of(
yup
.string()
.oneOf(_.values(webhookUtils.webhookEvents))
.required()
)
.min(1)
.required(),
events: yup.array().of(
yup
.string()
.oneOf(_.values(webhookUtils.webhookEvents))
.required()
),
})
.noUnknown();