From feb34f6b6b991046aab6a10df747b48fa4da07a7 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 6 May 2020 17:39:07 +0200 Subject: Use video abuse filters on client side --- server/helpers/custom-validators/video-abuses.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'server/helpers/custom-validators/video-abuses.ts') 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 @@ 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 } -- cgit v1.2.3