aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/follows.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-21 13:43:29 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:52 +0100
commit0f91ae62df8a37194fea84ce1efa9e733d9c1fd8 (patch)
tree1cb0fccadebb629d02632dc8e21fae7ba521c464 /server/middlewares/validators/follows.ts
parent81de19482b89342c3dbc098a9f512ef7f1056e45 (diff)
downloadPeerTube-0f91ae62df8a37194fea84ce1efa9e733d9c1fd8.tar.gz
PeerTube-0f91ae62df8a37194fea84ce1efa9e733d9c1fd8.tar.zst
PeerTube-0f91ae62df8a37194fea84ce1efa9e733d9c1fd8.zip
Add follow tests
Diffstat (limited to 'server/middlewares/validators/follows.ts')
-rw-r--r--server/middlewares/validators/follows.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/server/middlewares/validators/follows.ts b/server/middlewares/validators/follows.ts
index dfd6e7f03..ddc4c1de1 100644
--- a/server/middlewares/validators/follows.ts
+++ b/server/middlewares/validators/follows.ts
@@ -31,19 +31,19 @@ const removeFollowingValidator = [
31 param('accountId').custom(isIdOrUUIDValid).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 unfollow parameters', { parameters: req.params })
35 35
36 checkErrors(req, res, async () => { 36 checkErrors(req, res, async () => {
37 try { 37 try {
38 const serverAccount = await getServerAccount() 38 const serverAccount = await getServerAccount()
39 const following = await db.AccountFollow.loadByAccountAndTarget(serverAccount.id, req.params.accountId) 39 const follow = await db.AccountFollow.loadByAccountAndTarget(serverAccount.id, req.params.accountId)
40 40
41 if (!following) { 41 if (!follow) {
42 return res.status(404) 42 return res.status(404)
43 .end() 43 .end()
44 } 44 }
45 45
46 res.locals.following = following 46 res.locals.follow = follow
47 47
48 return next() 48 return next()
49 } catch (err) { 49 } catch (err) {