diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-11-20 11:19:23 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-11-27 19:40:52 +0100 |
commit | 7e9334c34db23e5ad1e118151b24c720dd985984 (patch) | |
tree | 154f5d1db44ff652b793d8e0b7dc1b00a3ddaec1 /server/middlewares | |
parent | 892211e8493b1f992fce7616cb1e48b7ff87a1dc (diff) | |
download | PeerTube-7e9334c34db23e5ad1e118151b24c720dd985984.tar.gz PeerTube-7e9334c34db23e5ad1e118151b24c720dd985984.tar.zst PeerTube-7e9334c34db23e5ad1e118151b24c720dd985984.zip |
Add ability to unfollow a server
Diffstat (limited to 'server/middlewares')
-rw-r--r-- | server/middlewares/validators/follows.ts | 6 |
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 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { body } from 'express-validator/check' | 2 | import { body, param } from 'express-validator/check' |
3 | import { isTestInstance } from '../../helpers/core-utils' | 3 | import { isTestInstance } from '../../helpers/core-utils' |
4 | import { isAccountIdValid } from '../../helpers/custom-validators/activitypub/account' | ||
5 | import { isEachUniqueHostValid } from '../../helpers/custom-validators/servers' | 4 | import { isEachUniqueHostValid } from '../../helpers/custom-validators/servers' |
6 | import { logger } from '../../helpers/logger' | 5 | import { logger } from '../../helpers/logger' |
7 | import { CONFIG, database as db } from '../../initializers' | 6 | import { CONFIG, database as db } from '../../initializers' |
8 | import { checkErrors } from './utils' | 7 | import { checkErrors } from './utils' |
9 | import { getServerAccount } from '../../helpers/utils' | 8 | import { getServerAccount } from '../../helpers/utils' |
9 | import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc' | ||
10 | 10 | ||
11 | const followValidator = [ | 11 | const 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 | ||
30 | const removeFollowingValidator = [ | 30 | const 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 }) |