diff options
author | Chocobozzz <me@florianbigard.com> | 2020-05-06 17:39:07 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-05-07 08:33:34 +0200 |
commit | feb34f6b6b991046aab6a10df747b48fa4da07a7 (patch) | |
tree | 02bb7277d45be166ba48caef2ee73bf89dbe1258 /server/helpers | |
parent | d170c5c580abf6f90d7bf144e2417e248ce2ecf4 (diff) | |
download | PeerTube-feb34f6b6b991046aab6a10df747b48fa4da07a7.tar.gz PeerTube-feb34f6b6b991046aab6a10df747b48fa4da07a7.tar.zst PeerTube-feb34f6b6b991046aab6a10df747b48fa4da07a7.zip |
Use video abuse filters on client side
Diffstat (limited to 'server/helpers')
-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 | } |