diff options
Diffstat (limited to 'server/middlewares/validators/user-subscriptions.ts')
-rw-r--r-- | server/middlewares/validators/user-subscriptions.ts | 12 |
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' | |||
9 | import { areValidationErrors } from './shared' | 9 | import { areValidationErrors } from './shared' |
10 | 10 | ||
11 | const userSubscriptionListValidator = [ | 11 | const 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 | ||
23 | const userSubscriptionAddValidator = [ | 25 | const 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 = [ | |||
35 | const areSubscriptionsExistValidator = [ | 38 | const 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 | ||
49 | const userSubscriptionGetValidator = [ | 52 | const 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 }) |