diff options
Diffstat (limited to 'server/helpers/custom-validators')
-rw-r--r-- | server/helpers/custom-validators/video-abuses.ts | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/server/helpers/custom-validators/video-abuses.ts b/server/helpers/custom-validators/video-abuses.ts index 5c7bc6fd9..05e11b1c6 100644 --- a/server/helpers/custom-validators/video-abuses.ts +++ b/server/helpers/custom-validators/video-abuses.ts | |||
@@ -1,6 +1,8 @@ | |||
1 | import validator from 'validator' | 1 | import validator from 'validator' |
2 | |||
2 | import { CONSTRAINTS_FIELDS, VIDEO_ABUSE_STATES } from '../../initializers/constants' | 3 | import { CONSTRAINTS_FIELDS, VIDEO_ABUSE_STATES } from '../../initializers/constants' |
3 | import { exists } from './misc' | 4 | import { exists } from './misc' |
5 | import { VideoAbuseVideoIs } from '@shared/models/videos/abuse/video-abuse-video-is.type' | ||
4 | 6 | ||
5 | const VIDEO_ABUSES_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_ABUSES | 7 | const VIDEO_ABUSES_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_ABUSES |
6 | 8 | ||
@@ -16,10 +18,18 @@ function isVideoAbuseStateValid (value: string) { | |||
16 | return exists(value) && VIDEO_ABUSE_STATES[value] !== undefined | 18 | return exists(value) && VIDEO_ABUSE_STATES[value] !== undefined |
17 | } | 19 | } |
18 | 20 | ||
21 | function isAbuseVideoIsValid (value: VideoAbuseVideoIs) { | ||
22 | return exists(value) && ( | ||
23 | value === 'deleted' || | ||
24 | value === 'blacklisted' | ||
25 | ) | ||
26 | } | ||
27 | |||
19 | // --------------------------------------------------------------------------- | 28 | // --------------------------------------------------------------------------- |
20 | 29 | ||
21 | export { | 30 | export { |
22 | isVideoAbuseStateValid, | 31 | isVideoAbuseStateValid, |
23 | isVideoAbuseReasonValid, | 32 | isVideoAbuseReasonValid, |
33 | isAbuseVideoIsValid, | ||
24 | isVideoAbuseModerationCommentValid | 34 | isVideoAbuseModerationCommentValid |
25 | } | 35 | } |