diff options
author | Chocobozzz <me@florianbigard.com> | 2017-12-22 10:50:07 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2017-12-22 11:29:12 +0100 |
commit | bf1f650817dadfd5eeee9e5e0b6b6938c136e25d (patch) | |
tree | 0f1dc95d87089be177ebe60740a55dd0c96b2414 /server/helpers/custom-validators/video-comments.ts | |
parent | 6d8524702874120a4667269a81a61e3c7c5e300d (diff) | |
download | PeerTube-bf1f650817dadfd5eeee9e5e0b6b6938c136e25d.tar.gz PeerTube-bf1f650817dadfd5eeee9e5e0b6b6938c136e25d.tar.zst PeerTube-bf1f650817dadfd5eeee9e5e0b6b6938c136e25d.zip |
Add comments controller
Diffstat (limited to 'server/helpers/custom-validators/video-comments.ts')
-rw-r--r-- | server/helpers/custom-validators/video-comments.ts | 16 |
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 @@ | |||
1 | import 'express-validator' | ||
2 | import 'multer' | ||
3 | import * as validator from 'validator' | ||
4 | import { CONSTRAINTS_FIELDS } from '../../initializers' | ||
5 | |||
6 | const VIDEO_COMMENTS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_COMMENTS | ||
7 | |||
8 | function isValidVideoCommentText (value: string) { | ||
9 | return value === null || validator.isLength(value, VIDEO_COMMENTS_CONSTRAINTS_FIELDS.TEXT) | ||
10 | } | ||
11 | |||
12 | // --------------------------------------------------------------------------- | ||
13 | |||
14 | export { | ||
15 | isValidVideoCommentText | ||
16 | } | ||