mirror of
https://github.com/sct/overseerr.git
synced 2025-09-17 17:24:35 +02:00
fix(frontend): notification type validation (#2207)
This commit is contained in:
@@ -48,13 +48,6 @@ const NotificationsDiscord: React.FC = () => {
|
|||||||
otherwise: Yup.string().nullable(),
|
otherwise: Yup.string().nullable(),
|
||||||
})
|
})
|
||||||
.url(intl.formatMessage(messages.validationUrl)),
|
.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) {
|
if (!data && !error) {
|
||||||
@@ -238,8 +231,8 @@ const NotificationsDiscord: React.FC = () => {
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
error={
|
error={
|
||||||
errors.types && touched.types
|
values.enabled && !values.types && touched.types
|
||||||
? (errors.types as string)
|
? intl.formatMessage(messages.validationTypes)
|
||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@@ -266,7 +259,12 @@ const NotificationsDiscord: React.FC = () => {
|
|||||||
<Button
|
<Button
|
||||||
buttonType="primary"
|
buttonType="primary"
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={isSubmitting || !isValid || isTesting}
|
disabled={
|
||||||
|
isSubmitting ||
|
||||||
|
!isValid ||
|
||||||
|
isTesting ||
|
||||||
|
(values.enabled && !values.types)
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<SaveIcon />
|
<SaveIcon />
|
||||||
<span>
|
<span>
|
||||||
|
@@ -45,13 +45,6 @@ const NotificationsLunaSea: React.FC = () => {
|
|||||||
otherwise: Yup.string().nullable(),
|
otherwise: Yup.string().nullable(),
|
||||||
})
|
})
|
||||||
.url(intl.formatMessage(messages.validationWebhookUrl)),
|
.url(intl.formatMessage(messages.validationWebhookUrl)),
|
||||||
types: Yup.number().when('enabled', {
|
|
||||||
is: true,
|
|
||||||
then: Yup.number()
|
|
||||||
.nullable()
|
|
||||||
.moreThan(0, intl.formatMessage(messages.validationTypes)),
|
|
||||||
otherwise: Yup.number().nullable(),
|
|
||||||
}),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!data && !error) {
|
if (!data && !error) {
|
||||||
@@ -217,8 +210,8 @@ const NotificationsLunaSea: React.FC = () => {
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
error={
|
error={
|
||||||
errors.types && touched.types
|
values.enabled && !values.types && touched.types
|
||||||
? (errors.types as string)
|
? intl.formatMessage(messages.validationTypes)
|
||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@@ -245,7 +238,12 @@ const NotificationsLunaSea: React.FC = () => {
|
|||||||
<Button
|
<Button
|
||||||
buttonType="primary"
|
buttonType="primary"
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={isSubmitting || !isValid || isTesting}
|
disabled={
|
||||||
|
isSubmitting ||
|
||||||
|
!isValid ||
|
||||||
|
isTesting ||
|
||||||
|
(values.enabled && !values.types)
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<SaveIcon />
|
<SaveIcon />
|
||||||
<span>
|
<span>
|
||||||
|
@@ -43,13 +43,6 @@ const NotificationsPushbullet: React.FC = () => {
|
|||||||
.required(intl.formatMessage(messages.validationAccessTokenRequired)),
|
.required(intl.formatMessage(messages.validationAccessTokenRequired)),
|
||||||
otherwise: Yup.string().nullable(),
|
otherwise: Yup.string().nullable(),
|
||||||
}),
|
}),
|
||||||
types: Yup.number().when('enabled', {
|
|
||||||
is: true,
|
|
||||||
then: Yup.number()
|
|
||||||
.nullable()
|
|
||||||
.moreThan(0, intl.formatMessage(messages.validationTypes)),
|
|
||||||
otherwise: Yup.number().nullable(),
|
|
||||||
}),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!data && !error) {
|
if (!data && !error) {
|
||||||
@@ -197,8 +190,8 @@ const NotificationsPushbullet: React.FC = () => {
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
error={
|
error={
|
||||||
errors.types && touched.types
|
values.enabled && !values.types && touched.types
|
||||||
? (errors.types as string)
|
? intl.formatMessage(messages.validationTypes)
|
||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@@ -225,7 +218,12 @@ const NotificationsPushbullet: React.FC = () => {
|
|||||||
<Button
|
<Button
|
||||||
buttonType="primary"
|
buttonType="primary"
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={isSubmitting || !isValid || isTesting}
|
disabled={
|
||||||
|
isSubmitting ||
|
||||||
|
!isValid ||
|
||||||
|
isTesting ||
|
||||||
|
(values.enabled && !values.types)
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<SaveIcon />
|
<SaveIcon />
|
||||||
<span>
|
<span>
|
||||||
|
@@ -62,13 +62,6 @@ const NotificationsPushover: React.FC = () => {
|
|||||||
/^[a-z\d]{30}$/i,
|
/^[a-z\d]{30}$/i,
|
||||||
intl.formatMessage(messages.validationUserTokenRequired)
|
intl.formatMessage(messages.validationUserTokenRequired)
|
||||||
),
|
),
|
||||||
types: Yup.number().when('enabled', {
|
|
||||||
is: true,
|
|
||||||
then: Yup.number()
|
|
||||||
.nullable()
|
|
||||||
.moreThan(0, intl.formatMessage(messages.validationTypes)),
|
|
||||||
otherwise: Yup.number().nullable(),
|
|
||||||
}),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!data && !error) {
|
if (!data && !error) {
|
||||||
@@ -243,8 +236,8 @@ const NotificationsPushover: React.FC = () => {
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
error={
|
error={
|
||||||
errors.types && touched.types
|
values.enabled && !values.types && touched.types
|
||||||
? (errors.types as string)
|
? intl.formatMessage(messages.validationTypes)
|
||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@@ -271,7 +264,12 @@ const NotificationsPushover: React.FC = () => {
|
|||||||
<Button
|
<Button
|
||||||
buttonType="primary"
|
buttonType="primary"
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={isSubmitting || !isValid || isTesting}
|
disabled={
|
||||||
|
isSubmitting ||
|
||||||
|
!isValid ||
|
||||||
|
isTesting ||
|
||||||
|
(values.enabled && !values.types)
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<SaveIcon />
|
<SaveIcon />
|
||||||
<span>
|
<span>
|
||||||
|
@@ -43,13 +43,6 @@ const NotificationsSlack: React.FC = () => {
|
|||||||
otherwise: Yup.string().nullable(),
|
otherwise: Yup.string().nullable(),
|
||||||
})
|
})
|
||||||
.url(intl.formatMessage(messages.validationWebhookUrl)),
|
.url(intl.formatMessage(messages.validationWebhookUrl)),
|
||||||
types: Yup.number().when('enabled', {
|
|
||||||
is: true,
|
|
||||||
then: Yup.number()
|
|
||||||
.nullable()
|
|
||||||
.moreThan(0, intl.formatMessage(messages.validationTypes)),
|
|
||||||
otherwise: Yup.number().nullable(),
|
|
||||||
}),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!data && !error) {
|
if (!data && !error) {
|
||||||
@@ -195,8 +188,8 @@ const NotificationsSlack: React.FC = () => {
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
error={
|
error={
|
||||||
errors.types && touched.types
|
values.enabled && !values.types && touched.types
|
||||||
? (errors.types as string)
|
? intl.formatMessage(messages.validationTypes)
|
||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@@ -223,7 +216,12 @@ const NotificationsSlack: React.FC = () => {
|
|||||||
<Button
|
<Button
|
||||||
buttonType="primary"
|
buttonType="primary"
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={isSubmitting || !isValid || isTesting}
|
disabled={
|
||||||
|
isSubmitting ||
|
||||||
|
!isValid ||
|
||||||
|
isTesting ||
|
||||||
|
(values.enabled && !values.types)
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<SaveIcon />
|
<SaveIcon />
|
||||||
<span>
|
<span>
|
||||||
|
@@ -101,13 +101,6 @@ const NotificationsWebhook: React.FC = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
types: Yup.number().when('enabled', {
|
|
||||||
is: true,
|
|
||||||
then: Yup.number()
|
|
||||||
.nullable()
|
|
||||||
.moreThan(0, intl.formatMessage(messages.validationTypes)),
|
|
||||||
otherwise: Yup.number().nullable(),
|
|
||||||
}),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!data && !error) {
|
if (!data && !error) {
|
||||||
@@ -312,8 +305,8 @@ const NotificationsWebhook: React.FC = () => {
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
error={
|
error={
|
||||||
errors.types && touched.types
|
values.enabled && !values.types && touched.types
|
||||||
? (errors.types as string)
|
? intl.formatMessage(messages.validationTypes)
|
||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@@ -340,7 +333,12 @@ const NotificationsWebhook: React.FC = () => {
|
|||||||
<Button
|
<Button
|
||||||
buttonType="primary"
|
buttonType="primary"
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={isSubmitting || !isValid || isTesting}
|
disabled={
|
||||||
|
isSubmitting ||
|
||||||
|
!isValid ||
|
||||||
|
isTesting ||
|
||||||
|
(values.enabled && !values.types)
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<SaveIcon />
|
<SaveIcon />
|
||||||
<span>
|
<span>
|
||||||
|
Reference in New Issue
Block a user