aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/follows.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-20 11:19:23 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:52 +0100
commit7e9334c34db23e5ad1e118151b24c720dd985984 (patch)
tree154f5d1db44ff652b793d8e0b7dc1b00a3ddaec1 /server/middlewares/validators/follows.ts
parent892211e8493b1f992fce7616cb1e48b7ff87a1dc (diff)
downloadPeerTube-7e9334c34db23e5ad1e118151b24c720dd985984.tar.gz
PeerTube-7e9334c34db23e5ad1e118151b24c720dd985984.tar.zst
PeerTube-7e9334c34db23e5ad1e118151b24c720dd985984.zip
Add ability to unfollow a server
Diffstat (limited to 'server/middlewares/validators/follows.ts')
-rw-r--r--server/middlewares/validators/follows.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/server/middlewares/validators/follows.ts b/server/middlewares/validators/follows.ts
index e22349726..dfd6e7f03 100644
--- a/server/middlewares/validators/follows.ts
+++ b/server/middlewares/validators/follows.ts
@@ -1,12 +1,12 @@
1import * as express from 'express' 1import * as express from 'express'
2import { body } from 'express-validator/check' 2import { body, param } from 'express-validator/check'
3import { isTestInstance } from '../../helpers/core-utils' 3import { isTestInstance } from '../../helpers/core-utils'
4import { isAccountIdValid } from '../../helpers/custom-validators/activitypub/account'
5import { isEachUniqueHostValid } from '../../helpers/custom-validators/servers' 4import { isEachUniqueHostValid } from '../../helpers/custom-validators/servers'
6import { logger } from '../../helpers/logger' 5import { logger } from '../../helpers/logger'
7import { CONFIG, database as db } from '../../initializers' 6import { CONFIG, database as db } from '../../initializers'
8import { checkErrors } from './utils' 7import { checkErrors } from './utils'
9import { getServerAccount } from '../../helpers/utils' 8import { getServerAccount } from '../../helpers/utils'
9import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc'
10 10
11const followValidator = [ 11const followValidator = [
12 body('hosts').custom(isEachUniqueHostValid).withMessage('Should have an array of unique hosts'), 12 body('hosts').custom(isEachUniqueHostValid).withMessage('Should have an array of unique hosts'),
@@ -28,7 +28,7 @@ const followValidator = [
28] 28]
29 29
30const removeFollowingValidator = [ 30const removeFollowingValidator = [
31 body('accountId').custom(isAccountIdValid).withMessage('Should have a valid account id'), 31 param('accountId').custom(isIdOrUUIDValid).withMessage('Should have a valid account id'),
32 32
33 (req: express.Request, res: express.Response, next: express.NextFunction) => { 33 (req: express.Request, res: express.Response, next: express.NextFunction) => {
34 logger.debug('Checking follow parameters', { parameters: req.body }) 34 logger.debug('Checking follow parameters', { parameters: req.body })