aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators/users.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/custom-validators/users.ts')
-rw-r--r--server/helpers/custom-validators/users.ts5
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
24function isUserDescriptionValid (value: string) {
25 return value === null || (exists(value) && validator.isLength(value, CONSTRAINTS_FIELDS.USERS.DESCRIPTION))
26}
27
24function isBoolean (value: any) { 28function 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}