aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/user-subscriptions.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-08-17 14:27:04 +0200
committerChocobozzz <me@florianbigard.com>2022-08-17 14:27:04 +0200
commit396f6f0140b0f76162e2378fd5a61e2f888673ed (patch)
treea5bd668bfc7dca7f311b9fc42ebb8bd01f462648 /server/middlewares/validators/user-subscriptions.ts
parent97eba003a9d0adcb0cab9190f566327b1417c7d3 (diff)
downloadPeerTube-396f6f0140b0f76162e2378fd5a61e2f888673ed.tar.gz
PeerTube-396f6f0140b0f76162e2378fd5a61e2f888673ed.tar.zst
PeerTube-396f6f0140b0f76162e2378fd5a61e2f888673ed.zip
Cleanup useless express validator messages
Diffstat (limited to 'server/middlewares/validators/user-subscriptions.ts')
-rw-r--r--server/middlewares/validators/user-subscriptions.ts12
1 files changed, 8 insertions, 4 deletions
diff --git a/server/middlewares/validators/user-subscriptions.ts b/server/middlewares/validators/user-subscriptions.ts
index 73da3142a..d9e6aa667 100644
--- a/server/middlewares/validators/user-subscriptions.ts
+++ b/server/middlewares/validators/user-subscriptions.ts
@@ -9,7 +9,9 @@ import { ActorFollowModel } from '../../models/actor/actor-follow'
9import { areValidationErrors } from './shared' 9import { areValidationErrors } from './shared'
10 10
11const userSubscriptionListValidator = [ 11const userSubscriptionListValidator = [
12 query('search').optional().not().isEmpty().withMessage('Should have a valid search'), 12 query('search')
13 .optional()
14 .not().isEmpty(),
13 15
14 (req: express.Request, res: express.Response, next: express.NextFunction) => { 16 (req: express.Request, res: express.Response, next: express.NextFunction) => {
15 logger.debug('Checking userSubscriptionListValidator parameters', { parameters: req.query }) 17 logger.debug('Checking userSubscriptionListValidator parameters', { parameters: req.query })
@@ -21,7 +23,8 @@ const userSubscriptionListValidator = [
21] 23]
22 24
23const userSubscriptionAddValidator = [ 25const userSubscriptionAddValidator = [
24 body('uri').custom(isValidActorHandle).withMessage('Should have a valid URI to follow (username@domain)'), 26 body('uri')
27 .custom(isValidActorHandle).withMessage('Should have a valid URI to follow (username@domain)'),
25 28
26 (req: express.Request, res: express.Response, next: express.NextFunction) => { 29 (req: express.Request, res: express.Response, next: express.NextFunction) => {
27 logger.debug('Checking userSubscriptionAddValidator parameters', { parameters: req.body }) 30 logger.debug('Checking userSubscriptionAddValidator parameters', { parameters: req.body })
@@ -35,7 +38,7 @@ const userSubscriptionAddValidator = [
35const areSubscriptionsExistValidator = [ 38const areSubscriptionsExistValidator = [
36 query('uris') 39 query('uris')
37 .customSanitizer(toArray) 40 .customSanitizer(toArray)
38 .custom(areValidActorHandles).withMessage('Should have a valid uri array'), 41 .custom(areValidActorHandles).withMessage('Should have a valid array of URIs'),
39 42
40 (req: express.Request, res: express.Response, next: express.NextFunction) => { 43 (req: express.Request, res: express.Response, next: express.NextFunction) => {
41 logger.debug('Checking areSubscriptionsExistValidator parameters', { parameters: req.query }) 44 logger.debug('Checking areSubscriptionsExistValidator parameters', { parameters: req.query })
@@ -47,7 +50,8 @@ const areSubscriptionsExistValidator = [
47] 50]
48 51
49const userSubscriptionGetValidator = [ 52const userSubscriptionGetValidator = [
50 param('uri').custom(isValidActorHandle).withMessage('Should have a valid URI to unfollow'), 53 param('uri')
54 .custom(isValidActorHandle),
51 55
52 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 56 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
53 logger.debug('Checking userSubscriptionGetValidator parameters', { parameters: req.params }) 57 logger.debug('Checking userSubscriptionGetValidator parameters', { parameters: req.params })