aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/follows.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2017-12-14 17:38:41 +0100
committerChocobozzz <me@florianbigard.com>2017-12-19 10:53:16 +0100
commit50d6de9c286abcb34ff4234d56d9cbb803db7665 (patch)
treef1732b27edcd05c7877a8358b8312f1e38c287ed /server/middlewares/validators/follows.ts
parentfadf619ad61a016c1c7fc53de5a8f398a4f77519 (diff)
downloadPeerTube-50d6de9c286abcb34ff4234d56d9cbb803db7665.tar.gz
PeerTube-50d6de9c286abcb34ff4234d56d9cbb803db7665.tar.zst
PeerTube-50d6de9c286abcb34ff4234d56d9cbb803db7665.zip
Begin moving video channel to actor
Diffstat (limited to 'server/middlewares/validators/follows.ts')
-rw-r--r--server/middlewares/validators/follows.ts13
1 files changed, 6 insertions, 7 deletions
diff --git a/server/middlewares/validators/follows.ts b/server/middlewares/validators/follows.ts
index 10482e5d0..2240d30db 100644
--- a/server/middlewares/validators/follows.ts
+++ b/server/middlewares/validators/follows.ts
@@ -1,10 +1,9 @@
1import * as express from 'express' 1import * as express from 'express'
2import { body, param } from 'express-validator/check' 2import { body, param } from 'express-validator/check'
3import { getServerAccount, isTestInstance, logger } from '../../helpers' 3import { getServerActor, isTestInstance, logger } from '../../helpers'
4import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc' 4import { isEachUniqueHostValid, isHostValid } from '../../helpers/custom-validators/servers'
5import { isEachUniqueHostValid } from '../../helpers/custom-validators/servers'
6import { CONFIG } from '../../initializers' 5import { CONFIG } from '../../initializers'
7import { AccountFollowModel } from '../../models/account/account-follow' 6import { ActorFollowModel } from '../../models/activitypub/actor-follow'
8import { areValidationErrors } from './utils' 7import { areValidationErrors } from './utils'
9 8
10const followValidator = [ 9const followValidator = [
@@ -29,15 +28,15 @@ const followValidator = [
29] 28]
30 29
31const removeFollowingValidator = [ 30const removeFollowingValidator = [
32 param('accountId').custom(isIdOrUUIDValid).withMessage('Should have a valid account id'), 31 param('host').custom(isHostValid).withMessage('Should have a valid host'),
33 32
34 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 33 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
35 logger.debug('Checking unfollow parameters', { parameters: req.params }) 34 logger.debug('Checking unfollow parameters', { parameters: req.params })
36 35
37 if (areValidationErrors(req, res)) return 36 if (areValidationErrors(req, res)) return
38 37
39 const serverAccount = await getServerAccount() 38 const serverActor = await getServerActor()
40 const follow = await AccountFollowModel.loadByAccountAndTarget(serverAccount.id, req.params.accountId) 39 const follow = await ActorFollowModel.loadByActorAndTargetHost(serverActor.id, req.params.host)
41 40
42 if (!follow) { 41 if (!follow) {
43 return res.status(404) 42 return res.status(404)