aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators/video-abuses.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-05-06 17:39:07 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-05-07 08:33:34 +0200
commitfeb34f6b6b991046aab6a10df747b48fa4da07a7 (patch)
tree02bb7277d45be166ba48caef2ee73bf89dbe1258 /server/helpers/custom-validators/video-abuses.ts
parentd170c5c580abf6f90d7bf144e2417e248ce2ecf4 (diff)
downloadPeerTube-feb34f6b6b991046aab6a10df747b48fa4da07a7.tar.gz
PeerTube-feb34f6b6b991046aab6a10df747b48fa4da07a7.tar.zst
PeerTube-feb34f6b6b991046aab6a10df747b48fa4da07a7.zip
Use video abuse filters on client side
Diffstat (limited to 'server/helpers/custom-validators/video-abuses.ts')
-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}