diff options
author | Chocobozzz <me@florianbigard.com> | 2018-08-08 17:36:10 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-08-08 17:44:22 +0200 |
commit | eacb25c4366bcc8fba20f98f93f004fabc6d5578 (patch) | |
tree | d006c6ef3358ec8c3e3deda643dc9b70068f2515 /server/helpers/custom-validators/users.ts | |
parent | a6ce68673ace5b94a81eda3ba198f0a4170eb05e (diff) | |
download | PeerTube-eacb25c4366bcc8fba20f98f93f004fabc6d5578.tar.gz PeerTube-eacb25c4366bcc8fba20f98f93f004fabc6d5578.tar.zst PeerTube-eacb25c4366bcc8fba20f98f93f004fabc6d5578.zip |
Add reason when banning a user
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 4a0d79ae5..c3cdefd4e 100644 --- a/server/helpers/custom-validators/users.ts +++ b/server/helpers/custom-validators/users.ts | |||
@@ -42,6 +42,10 @@ function isUserBlockedValid (value: any) { | |||
42 | return isBooleanValid(value) | 42 | return isBooleanValid(value) |
43 | } | 43 | } |
44 | 44 | ||
45 | function isUserBlockedReasonValid (value: any) { | ||
46 | return value === null || (exists(value) && validator.isLength(value, CONSTRAINTS_FIELDS.USERS.BLOCKED_REASON)) | ||
47 | } | ||
48 | |||
45 | function isUserRoleValid (value: any) { | 49 | function isUserRoleValid (value: any) { |
46 | return exists(value) && validator.isInt('' + value) && UserRole[value] !== undefined | 50 | return exists(value) && validator.isInt('' + value) && UserRole[value] !== undefined |
47 | } | 51 | } |
@@ -59,6 +63,7 @@ function isAvatarFile (files: { [ fieldname: string ]: Express.Multer.File[] } | | |||
59 | export { | 63 | export { |
60 | isUserBlockedValid, | 64 | isUserBlockedValid, |
61 | isUserPasswordValid, | 65 | isUserPasswordValid, |
66 | isUserBlockedReasonValid, | ||
62 | isUserRoleValid, | 67 | isUserRoleValid, |
63 | isUserVideoQuotaValid, | 68 | isUserVideoQuotaValid, |
64 | isUserUsernameValid, | 69 | isUserUsernameValid, |