aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-07-24 15:05:51 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-07-31 11:35:19 +0200
commitedbc9325462ddf4536775871ebc25e06f46612d1 (patch)
tree9671dd51303e75d48d4f4f9a1df7a1960e33780d /server/helpers/custom-validators
parent20516920d2b72c8a18bc24b9740f7176aa962da2 (diff)
downloadPeerTube-edbc9325462ddf4536775871ebc25e06f46612d1.tar.gz
PeerTube-edbc9325462ddf4536775871ebc25e06f46612d1.tar.zst
PeerTube-edbc9325462ddf4536775871ebc25e06f46612d1.zip
Add server API to abuse messages
Diffstat (limited to 'server/helpers/custom-validators')
-rw-r--r--server/helpers/custom-validators/abuses.ts8
1 files changed, 7 insertions, 1 deletions
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'
4import { exists, isArray } from './misc' 4import { exists, isArray } from './misc'
5 5
6const ABUSES_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.ABUSES 6const ABUSES_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.ABUSES
7const ABUSE_MESSAGES_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.ABUSE_MESSAGES
7 8
8function isAbuseReasonValid (value: string) { 9function isAbuseReasonValid (value: string) {
9 return exists(value) && validator.isLength(value, ABUSES_CONSTRAINTS_FIELDS.REASON) 10 return exists(value) && validator.isLength(value, ABUSES_CONSTRAINTS_FIELDS.REASON)
@@ -46,13 +47,18 @@ function isAbuseVideoIsValid (value: AbuseVideoIs) {
46 ) 47 )
47} 48}
48 49
50function isAbuseMessageValid (value: string) {
51 return exists(value) && validator.isLength(value, ABUSE_MESSAGES_CONSTRAINTS_FIELDS.MESSAGE)
52}
53
49// --------------------------------------------------------------------------- 54// ---------------------------------------------------------------------------
50 55
51export { 56export {
52 isAbuseReasonValid, 57 isAbuseReasonValid,
53 isAbuseFilterValid, 58 isAbuseFilterValid,
54 isAbusePredefinedReasonValid, 59 isAbusePredefinedReasonValid,
55 areAbusePredefinedReasonsValid as isAbusePredefinedReasonsValid, 60 isAbuseMessageValid,
61 areAbusePredefinedReasonsValid,
56 isAbuseTimestampValid, 62 isAbuseTimestampValid,
57 isAbuseTimestampCoherent, 63 isAbuseTimestampCoherent,
58 isAbuseModerationCommentValid, 64 isAbuseModerationCommentValid,