aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers')
-rw-r--r--server/helpers/custom-validators/video-abuses.ts10
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 @@
1import validator from 'validator' 1import validator from 'validator'
2
2import { CONSTRAINTS_FIELDS, VIDEO_ABUSE_STATES } from '../../initializers/constants' 3import { CONSTRAINTS_FIELDS, VIDEO_ABUSE_STATES } from '../../initializers/constants'
3import { exists } from './misc' 4import { exists } from './misc'
5import { VideoAbuseVideoIs } from '@shared/models/videos/abuse/video-abuse-video-is.type'
4 6
5const VIDEO_ABUSES_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_ABUSES 7const 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
21function isAbuseVideoIsValid (value: VideoAbuseVideoIs) {
22 return exists(value) && (
23 value === 'deleted' ||
24 value === 'blacklisted'
25 )
26}
27
19// --------------------------------------------------------------------------- 28// ---------------------------------------------------------------------------
20 29
21export { 30export {
22 isVideoAbuseStateValid, 31 isVideoAbuseStateValid,
23 isVideoAbuseReasonValid, 32 isVideoAbuseReasonValid,
33 isAbuseVideoIsValid,
24 isVideoAbuseModerationCommentValid 34 isVideoAbuseModerationCommentValid
25} 35}