diff options
author | Chocobozzz <me@florianbigard.com> | 2022-08-17 14:27:04 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-08-17 14:27:04 +0200 |
commit | 396f6f0140b0f76162e2378fd5a61e2f888673ed (patch) | |
tree | a5bd668bfc7dca7f311b9fc42ebb8bd01f462648 /server/middlewares/validators/blocklist.ts | |
parent | 97eba003a9d0adcb0cab9190f566327b1417c7d3 (diff) | |
download | PeerTube-396f6f0140b0f76162e2378fd5a61e2f888673ed.tar.gz PeerTube-396f6f0140b0f76162e2378fd5a61e2f888673ed.tar.zst PeerTube-396f6f0140b0f76162e2378fd5a61e2f888673ed.zip |
Cleanup useless express validator messages
Diffstat (limited to 'server/middlewares/validators/blocklist.ts')
-rw-r--r-- | server/middlewares/validators/blocklist.ts | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/server/middlewares/validators/blocklist.ts b/server/middlewares/validators/blocklist.ts index 12980ced4..3de614522 100644 --- a/server/middlewares/validators/blocklist.ts +++ b/server/middlewares/validators/blocklist.ts | |||
@@ -13,7 +13,8 @@ import { ServerBlocklistModel } from '../../models/server/server-blocklist' | |||
13 | import { areValidationErrors, doesAccountNameWithHostExist } from './shared' | 13 | import { areValidationErrors, doesAccountNameWithHostExist } from './shared' |
14 | 14 | ||
15 | const blockAccountValidator = [ | 15 | const blockAccountValidator = [ |
16 | body('accountName').exists().withMessage('Should have an account name with host'), | 16 | body('accountName') |
17 | .exists(), | ||
17 | 18 | ||
18 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 19 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
19 | logger.debug('Checking blockAccountByAccountValidator parameters', { parameters: req.body }) | 20 | logger.debug('Checking blockAccountByAccountValidator parameters', { parameters: req.body }) |
@@ -37,7 +38,8 @@ const blockAccountValidator = [ | |||
37 | ] | 38 | ] |
38 | 39 | ||
39 | const unblockAccountByAccountValidator = [ | 40 | const unblockAccountByAccountValidator = [ |
40 | param('accountName').exists().withMessage('Should have an account name with host'), | 41 | param('accountName') |
42 | .exists(), | ||
41 | 43 | ||
42 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 44 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
43 | logger.debug('Checking unblockAccountByAccountValidator parameters', { parameters: req.params }) | 45 | logger.debug('Checking unblockAccountByAccountValidator parameters', { parameters: req.params }) |
@@ -54,7 +56,8 @@ const unblockAccountByAccountValidator = [ | |||
54 | ] | 56 | ] |
55 | 57 | ||
56 | const unblockAccountByServerValidator = [ | 58 | const unblockAccountByServerValidator = [ |
57 | param('accountName').exists().withMessage('Should have an account name with host'), | 59 | param('accountName') |
60 | .exists(), | ||
58 | 61 | ||
59 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 62 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
60 | logger.debug('Checking unblockAccountByServerValidator parameters', { parameters: req.params }) | 63 | logger.debug('Checking unblockAccountByServerValidator parameters', { parameters: req.params }) |
@@ -71,7 +74,8 @@ const unblockAccountByServerValidator = [ | |||
71 | ] | 74 | ] |
72 | 75 | ||
73 | const blockServerValidator = [ | 76 | const blockServerValidator = [ |
74 | body('host').custom(isHostValid).withMessage('Should have a valid host'), | 77 | body('host') |
78 | .custom(isHostValid), | ||
75 | 79 | ||
76 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 80 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
77 | logger.debug('Checking serverGetValidator parameters', { parameters: req.body }) | 81 | logger.debug('Checking serverGetValidator parameters', { parameters: req.body }) |
@@ -96,7 +100,8 @@ const blockServerValidator = [ | |||
96 | ] | 100 | ] |
97 | 101 | ||
98 | const unblockServerByAccountValidator = [ | 102 | const unblockServerByAccountValidator = [ |
99 | param('host').custom(isHostValid).withMessage('Should have an account name with host'), | 103 | param('host') |
104 | .custom(isHostValid), | ||
100 | 105 | ||
101 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 106 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
102 | logger.debug('Checking unblockServerByAccountValidator parameters', { parameters: req.params }) | 107 | logger.debug('Checking unblockServerByAccountValidator parameters', { parameters: req.params }) |
@@ -111,7 +116,8 @@ const unblockServerByAccountValidator = [ | |||
111 | ] | 116 | ] |
112 | 117 | ||
113 | const unblockServerByServerValidator = [ | 118 | const unblockServerByServerValidator = [ |
114 | param('host').custom(isHostValid).withMessage('Should have an account name with host'), | 119 | param('host') |
120 | .custom(isHostValid), | ||
115 | 121 | ||
116 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 122 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
117 | logger.debug('Checking unblockServerByServerValidator parameters', { parameters: req.params }) | 123 | logger.debug('Checking unblockServerByServerValidator parameters', { parameters: req.params }) |