2020-01-07 14:56:07 +01:00
|
|
|
import validator from 'validator'
|
2019-04-11 14:26:41 +02:00
|
|
|
import { CONSTRAINTS_FIELDS, VIDEO_ABUSE_STATES } from '../../initializers/constants'
|
2018-08-10 16:54:01 +02:00
|
|
|
import { exists } from './misc'
|
|
|
|
|
|
|
|
const VIDEO_ABUSES_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_ABUSES
|
|
|
|
|
|
|
|
function isVideoAbuseReasonValid (value: string) {
|
|
|
|
return exists(value) && validator.isLength(value, VIDEO_ABUSES_CONSTRAINTS_FIELDS.REASON)
|
|
|
|
}
|
|
|
|
|
|
|
|
function isVideoAbuseModerationCommentValid (value: string) {
|
|
|
|
return exists(value) && validator.isLength(value, VIDEO_ABUSES_CONSTRAINTS_FIELDS.MODERATION_COMMENT)
|
|
|
|
}
|
|
|
|
|
|
|
|
function isVideoAbuseStateValid (value: string) {
|
2020-01-31 16:56:52 +01:00
|
|
|
return exists(value) && VIDEO_ABUSE_STATES[value] !== undefined
|
2018-08-10 16:54:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
export {
|
|
|
|
isVideoAbuseStateValid,
|
|
|
|
isVideoAbuseReasonValid,
|
|
|
|
isVideoAbuseModerationCommentValid
|
|
|
|
}
|