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