aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2017-12-22 10:50:07 +0100
committerChocobozzz <me@florianbigard.com>2017-12-22 11:29:12 +0100
commitbf1f650817dadfd5eeee9e5e0b6b6938c136e25d (patch)
tree0f1dc95d87089be177ebe60740a55dd0c96b2414 /server/helpers/custom-validators
parent6d8524702874120a4667269a81a61e3c7c5e300d (diff)
downloadPeerTube-bf1f650817dadfd5eeee9e5e0b6b6938c136e25d.tar.gz
PeerTube-bf1f650817dadfd5eeee9e5e0b6b6938c136e25d.tar.zst
PeerTube-bf1f650817dadfd5eeee9e5e0b6b6938c136e25d.zip
Add comments controller
Diffstat (limited to 'server/helpers/custom-validators')
-rw-r--r--server/helpers/custom-validators/video-comments.ts16
1 files changed, 16 insertions, 0 deletions
diff --git a/server/helpers/custom-validators/video-comments.ts b/server/helpers/custom-validators/video-comments.ts
new file mode 100644
index 000000000..2b3f66063
--- /dev/null
+++ b/server/helpers/custom-validators/video-comments.ts
@@ -0,0 +1,16 @@
1import 'express-validator'
2import 'multer'
3import * as validator from 'validator'
4import { CONSTRAINTS_FIELDS } from '../../initializers'
5
6const VIDEO_COMMENTS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_COMMENTS
7
8function isValidVideoCommentText (value: string) {
9 return value === null || validator.isLength(value, VIDEO_COMMENTS_CONSTRAINTS_FIELDS.TEXT)
10}
11
12// ---------------------------------------------------------------------------
13
14export {
15 isValidVideoCommentText
16}