1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 02:39:33 +02:00

Use video abuse filters on client side

This commit is contained in:
Chocobozzz 2020-05-06 17:39:07 +02:00 committed by Chocobozzz
parent d170c5c580
commit feb34f6b6b
13 changed files with 343 additions and 154 deletions

View file

@ -1,6 +1,8 @@
import validator from 'validator'
import { CONSTRAINTS_FIELDS, VIDEO_ABUSE_STATES } from '../../initializers/constants'
import { exists } from './misc'
import { VideoAbuseVideoIs } from '@shared/models/videos/abuse/video-abuse-video-is.type'
const VIDEO_ABUSES_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_ABUSES
@ -16,10 +18,18 @@ function isVideoAbuseStateValid (value: string) {
return exists(value) && VIDEO_ABUSE_STATES[value] !== undefined
}
function isAbuseVideoIsValid (value: VideoAbuseVideoIs) {
return exists(value) && (
value === 'deleted' ||
value === 'blacklisted'
)
}
// ---------------------------------------------------------------------------
export {
isVideoAbuseStateValid,
isVideoAbuseReasonValid,
isAbuseVideoIsValid,
isVideoAbuseModerationCommentValid
}