From edbc9325462ddf4536775871ebc25e06f46612d1 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 24 Jul 2020 15:05:51 +0200 Subject: Add server API to abuse messages --- server/helpers/custom-validators/abuses.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'server/helpers/custom-validators/abuses.ts') diff --git a/server/helpers/custom-validators/abuses.ts b/server/helpers/custom-validators/abuses.ts index 0ca06a252..0ddde4b06 100644 --- a/server/helpers/custom-validators/abuses.ts +++ b/server/helpers/custom-validators/abuses.ts @@ -4,6 +4,7 @@ import { ABUSE_STATES, CONSTRAINTS_FIELDS } from '../../initializers/constants' import { exists, isArray } from './misc' const ABUSES_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.ABUSES +const ABUSE_MESSAGES_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.ABUSE_MESSAGES function isAbuseReasonValid (value: string) { return exists(value) && validator.isLength(value, ABUSES_CONSTRAINTS_FIELDS.REASON) @@ -46,13 +47,18 @@ function isAbuseVideoIsValid (value: AbuseVideoIs) { ) } +function isAbuseMessageValid (value: string) { + return exists(value) && validator.isLength(value, ABUSE_MESSAGES_CONSTRAINTS_FIELDS.MESSAGE) +} + // --------------------------------------------------------------------------- export { isAbuseReasonValid, isAbuseFilterValid, isAbusePredefinedReasonValid, - areAbusePredefinedReasonsValid as isAbusePredefinedReasonsValid, + isAbuseMessageValid, + areAbusePredefinedReasonsValid, isAbuseTimestampValid, isAbuseTimestampCoherent, isAbuseModerationCommentValid, -- cgit v1.2.3