aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-11-28 11:37:32 +0100
committerChocobozzz <me@florianbigard.com>2019-11-28 11:37:32 +0100
commitb8f4167fb6fa448125aeecff80b201d74e27fe6a (patch)
tree33179fe38e113b3bd88bae9782f4741754a85159 /server/middlewares/validators
parentd275e75453015352d5b9387eaf5078e1ba5e0ea2 (diff)
downloadPeerTube-b8f4167fb6fa448125aeecff80b201d74e27fe6a.tar.gz
PeerTube-b8f4167fb6fa448125aeecff80b201d74e27fe6a.tar.zst
PeerTube-b8f4167fb6fa448125aeecff80b201d74e27fe6a.zip
Only display accepted followers/followings in about page
Diffstat (limited to 'server/middlewares/validators')
-rw-r--r--server/middlewares/validators/follows.ts18
1 files changed, 16 insertions, 2 deletions
diff --git a/server/middlewares/validators/follows.ts b/server/middlewares/validators/follows.ts
index 788735663..454f9f2b8 100644
--- a/server/middlewares/validators/follows.ts
+++ b/server/middlewares/validators/follows.ts
@@ -1,5 +1,5 @@
1import * as express from 'express' 1import * as express from 'express'
2import { body, param } from 'express-validator' 2import { body, param, query } from 'express-validator'
3import { isTestInstance } from '../../helpers/core-utils' 3import { isTestInstance } from '../../helpers/core-utils'
4import { isEachUniqueHostValid, isHostValid } from '../../helpers/custom-validators/servers' 4import { isEachUniqueHostValid, isHostValid } from '../../helpers/custom-validators/servers'
5import { logger } from '../../helpers/logger' 5import { logger } from '../../helpers/logger'
@@ -11,6 +11,19 @@ import { ActorModel } from '../../models/activitypub/actor'
11import { loadActorUrlOrGetFromWebfinger } from '../../helpers/webfinger' 11import { loadActorUrlOrGetFromWebfinger } from '../../helpers/webfinger'
12import { isValidActorHandle } from '../../helpers/custom-validators/activitypub/actor' 12import { isValidActorHandle } from '../../helpers/custom-validators/activitypub/actor'
13import { MActorFollowActorsDefault } from '@server/typings/models' 13import { MActorFollowActorsDefault } from '@server/typings/models'
14import { isFollowStateValid } from '@server/helpers/custom-validators/follows'
15
16const listFollowsValidator = [
17 query('state')
18 .optional()
19 .custom(isFollowStateValid).withMessage('Should have a valid follow state'),
20
21 (req: express.Request, res: express.Response, next: express.NextFunction) => {
22 if (areValidationErrors(req, res)) return
23
24 return next()
25 }
26]
14 27
15const followValidator = [ 28const followValidator = [
16 body('hosts').custom(isEachUniqueHostValid).withMessage('Should have an array of unique hosts'), 29 body('hosts').custom(isEachUniqueHostValid).withMessage('Should have an array of unique hosts'),
@@ -110,5 +123,6 @@ export {
110 followValidator, 123 followValidator,
111 removeFollowingValidator, 124 removeFollowingValidator,
112 getFollowerValidator, 125 getFollowerValidator,
113 acceptOrRejectFollowerValidator 126 acceptOrRejectFollowerValidator,
127 listFollowsValidator
114} 128}