From 2f204b995269a53ae36f2a8733f27ae6ab70da5a Mon Sep 17 00:00:00 2001 From: TheCatLady <52870424+TheCatLady@users.noreply.github.com> Date: Fri, 15 Oct 2021 21:02:02 -0400 Subject: [PATCH] fix(frontend): notification type validation (#2207) --- .../Notifications/NotificationsDiscord.tsx | 18 ++++++++---------- .../NotificationsLunaSea/index.tsx | 18 ++++++++---------- .../NotificationsPushbullet/index.tsx | 18 ++++++++---------- .../NotificationsPushover/index.tsx | 18 ++++++++---------- .../Notifications/NotificationsSlack/index.tsx | 18 ++++++++---------- .../NotificationsWebhook/index.tsx | 18 ++++++++---------- 6 files changed, 48 insertions(+), 60 deletions(-) diff --git a/src/components/Settings/Notifications/NotificationsDiscord.tsx b/src/components/Settings/Notifications/NotificationsDiscord.tsx index 7ade37603..67cfa031a 100644 --- a/src/components/Settings/Notifications/NotificationsDiscord.tsx +++ b/src/components/Settings/Notifications/NotificationsDiscord.tsx @@ -48,13 +48,6 @@ const NotificationsDiscord: React.FC = () => { otherwise: Yup.string().nullable(), }) .url(intl.formatMessage(messages.validationUrl)), - types: Yup.number().when('enabled', { - is: true, - then: Yup.number() - .nullable() - .moreThan(0, intl.formatMessage(messages.validationTypes)), - otherwise: Yup.number().nullable(), - }), }); if (!data && !error) { @@ -238,8 +231,8 @@ const NotificationsDiscord: React.FC = () => { } }} error={ - errors.types && touched.types - ? (errors.types as string) + values.enabled && !values.types && touched.types + ? intl.formatMessage(messages.validationTypes) : undefined } /> @@ -266,7 +259,12 @@ const NotificationsDiscord: React.FC = () => {