diff --git a/changes/11714-policy-automations-bug b/changes/11714-policy-automations-bug new file mode 100644 index 0000000000..0fe2a96187 --- /dev/null +++ b/changes/11714-policy-automations-bug @@ -0,0 +1 @@ +- Fix a bug where policy automations couldn't be updated without a webhook URL diff --git a/frontend/pages/policies/ManagePoliciesPage/components/ManageAutomationsModal/ManageAutomationsModal.tsx b/frontend/pages/policies/ManagePoliciesPage/components/ManageAutomationsModal/ManageAutomationsModal.tsx index c99c2781a7..b8bbdba759 100644 --- a/frontend/pages/policies/ManagePoliciesPage/components/ManageAutomationsModal/ManageAutomationsModal.tsx +++ b/frontend/pages/policies/ManagePoliciesPage/components/ManageAutomationsModal/ManageAutomationsModal.tsx @@ -173,12 +173,6 @@ const ManageAutomationsModal = ({ policyItems?.forEach((p) => p.isChecked && newPolicyIds.push(p.id)); const newErrors = { ...errors }; - // if (isPolicyAutomationsEnabled && !newPolicyIds.length) { - // newErrors.policyItems = - // "Please choose at least one policy you want to listen to:"; - // } else { - // delete newErrors.policyItems; - // } if ( isPolicyAutomationsEnabled && @@ -191,12 +185,14 @@ const ManageAutomationsModal = ({ delete newErrors.integration; } - if (isWebhookEnabled && !destinationUrl) { - newErrors.url = "Please add a destination URL"; - } else if (!validUrl({ url: destinationUrl })) { - newErrors.url = `${destinationUrl} is not a valid URL`; - } else { - delete newErrors.url; + if (isWebhookEnabled) { + if (!destinationUrl) { + newErrors.url = "Please add a destination URL"; + } else if (!validUrl({ url: destinationUrl })) { + newErrors.url = `${destinationUrl} is not a valid URL`; + } else { + delete newErrors.url; + } } if (!isEmpty(newErrors)) {