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/middlewares | |
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/middlewares')
-rw-r--r-- | server/middlewares/validators/users.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/server/middlewares/validators/users.ts b/server/middlewares/validators/users.ts index 94d8ab53b..771c414a0 100644 --- a/server/middlewares/validators/users.ts +++ b/server/middlewares/validators/users.ts | |||
@@ -5,7 +5,7 @@ import { body, param } from 'express-validator/check' | |||
5 | import { omit } from 'lodash' | 5 | import { omit } from 'lodash' |
6 | import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc' | 6 | import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc' |
7 | import { | 7 | import { |
8 | isUserAutoPlayVideoValid, | 8 | isUserAutoPlayVideoValid, isUserBlockedReasonValid, |
9 | isUserDescriptionValid, | 9 | isUserDescriptionValid, |
10 | isUserDisplayNameValid, | 10 | isUserDisplayNameValid, |
11 | isUserNSFWPolicyValid, | 11 | isUserNSFWPolicyValid, |
@@ -76,9 +76,10 @@ const usersRemoveValidator = [ | |||
76 | 76 | ||
77 | const usersBlockingValidator = [ | 77 | const usersBlockingValidator = [ |
78 | param('id').isInt().not().isEmpty().withMessage('Should have a valid id'), | 78 | param('id').isInt().not().isEmpty().withMessage('Should have a valid id'), |
79 | body('reason').optional().custom(isUserBlockedReasonValid).withMessage('Should have a valid blocking reason'), | ||
79 | 80 | ||
80 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 81 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
81 | logger.debug('Checking usersRemove parameters', { parameters: req.params }) | 82 | logger.debug('Checking usersBlocking parameters', { parameters: req.params }) |
82 | 83 | ||
83 | if (areValidationErrors(req, res)) return | 84 | if (areValidationErrors(req, res)) return |
84 | if (!await checkUserIdExist(req.params.id, res)) return | 85 | if (!await checkUserIdExist(req.params.id, res)) return |