diff options
author | Chocobozzz <me@florianbigard.com> | 2018-02-15 14:46:26 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-02-15 15:29:07 +0100 |
commit | 2422c46b27790d94fd29a7092170cee5a1b56008 (patch) | |
tree | d5c1942ce20cadb27a551d87c789edfe92f5b105 /server/helpers/custom-validators/users.ts | |
parent | 34cbef8c6cc912143a421413bdd832c4adcc556a (diff) | |
download | PeerTube-2422c46b27790d94fd29a7092170cee5a1b56008.tar.gz PeerTube-2422c46b27790d94fd29a7092170cee5a1b56008.tar.zst PeerTube-2422c46b27790d94fd29a7092170cee5a1b56008.zip |
Implement support field in video and video channel
Diffstat (limited to 'server/helpers/custom-validators/users.ts')
-rw-r--r-- | server/helpers/custom-validators/users.ts | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/server/helpers/custom-validators/users.ts b/server/helpers/custom-validators/users.ts index e805313f8..bbc7cc199 100644 --- a/server/helpers/custom-validators/users.ts +++ b/server/helpers/custom-validators/users.ts | |||
@@ -21,6 +21,10 @@ function isUserUsernameValid (value: string) { | |||
21 | return exists(value) && validator.matches(value, new RegExp(`^[a-z0-9._]{${min},${max}}$`)) | 21 | return exists(value) && validator.matches(value, new RegExp(`^[a-z0-9._]{${min},${max}}$`)) |
22 | } | 22 | } |
23 | 23 | ||
24 | function isUserDescriptionValid (value: string) { | ||
25 | return value === null || (exists(value) && validator.isLength(value, CONSTRAINTS_FIELDS.USERS.DESCRIPTION)) | ||
26 | } | ||
27 | |||
24 | function isBoolean (value: any) { | 28 | function isBoolean (value: any) { |
25 | return typeof value === 'boolean' || (typeof value === 'string' && validator.isBoolean(value)) | 29 | return typeof value === 'boolean' || (typeof value === 'string' && validator.isBoolean(value)) |
26 | } | 30 | } |
@@ -54,5 +58,6 @@ export { | |||
54 | isUserUsernameValid, | 58 | isUserUsernameValid, |
55 | isUserDisplayNSFWValid, | 59 | isUserDisplayNSFWValid, |
56 | isUserAutoPlayVideoValid, | 60 | isUserAutoPlayVideoValid, |
61 | isUserDescriptionValid, | ||
57 | isAvatarFile | 62 | isAvatarFile |
58 | } | 63 | } |