aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-08-08 17:36:10 +0200
committerChocobozzz <me@florianbigard.com>2018-08-08 17:44:22 +0200
commiteacb25c4366bcc8fba20f98f93f004fabc6d5578 (patch)
treed006c6ef3358ec8c3e3deda643dc9b70068f2515 /server/middlewares/validators
parenta6ce68673ace5b94a81eda3ba198f0a4170eb05e (diff)
downloadPeerTube-eacb25c4366bcc8fba20f98f93f004fabc6d5578.tar.gz
PeerTube-eacb25c4366bcc8fba20f98f93f004fabc6d5578.tar.zst
PeerTube-eacb25c4366bcc8fba20f98f93f004fabc6d5578.zip
Add reason when banning a user
Diffstat (limited to 'server/middlewares/validators')
-rw-r--r--server/middlewares/validators/users.ts5
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'
5import { omit } from 'lodash' 5import { omit } from 'lodash'
6import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc' 6import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc'
7import { 7import {
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
77const usersBlockingValidator = [ 77const 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