aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
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/controllers
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/controllers')
-rw-r--r--server/controllers/api/server/follows.ts35
1 files changed, 20 insertions, 15 deletions
diff --git a/server/controllers/api/server/follows.ts b/server/controllers/api/server/follows.ts
index 37647622b..e7fd3aabd 100644
--- a/server/controllers/api/server/follows.ts
+++ b/server/controllers/api/server/follows.ts
@@ -19,7 +19,8 @@ import {
19 followingSortValidator, 19 followingSortValidator,
20 followValidator, 20 followValidator,
21 getFollowerValidator, 21 getFollowerValidator,
22 removeFollowingValidator 22 removeFollowingValidator,
23 listFollowsValidator
23} from '../../../middlewares/validators' 24} from '../../../middlewares/validators'
24import { ActorFollowModel } from '../../../models/activitypub/actor-follow' 25import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
25import { JobQueue } from '../../../lib/job-queue' 26import { JobQueue } from '../../../lib/job-queue'
@@ -29,6 +30,7 @@ import { autoFollowBackIfNeeded } from '../../../lib/activitypub/follow'
29 30
30const serverFollowsRouter = express.Router() 31const serverFollowsRouter = express.Router()
31serverFollowsRouter.get('/following', 32serverFollowsRouter.get('/following',
33 listFollowsValidator,
32 paginationValidator, 34 paginationValidator,
33 followingSortValidator, 35 followingSortValidator,
34 setDefaultSort, 36 setDefaultSort,
@@ -52,6 +54,7 @@ serverFollowsRouter.delete('/following/:host',
52) 54)
53 55
54serverFollowsRouter.get('/followers', 56serverFollowsRouter.get('/followers',
57 listFollowsValidator,
55 paginationValidator, 58 paginationValidator,
56 followersSortValidator, 59 followersSortValidator,
57 setDefaultSort, 60 setDefaultSort,
@@ -92,26 +95,28 @@ export {
92 95
93async function listFollowing (req: express.Request, res: express.Response) { 96async function listFollowing (req: express.Request, res: express.Response) {
94 const serverActor = await getServerActor() 97 const serverActor = await getServerActor()
95 const resultList = await ActorFollowModel.listFollowingForApi( 98 const resultList = await ActorFollowModel.listFollowingForApi({
96 serverActor.id, 99 id: serverActor.id,
97 req.query.start, 100 start: req.query.start,
98 req.query.count, 101 count: req.query.count,
99 req.query.sort, 102 sort: req.query.sort,
100 req.query.search 103 search: req.query.search,
101 ) 104 state: req.query.state
105 })
102 106
103 return res.json(getFormattedObjects(resultList.data, resultList.total)) 107 return res.json(getFormattedObjects(resultList.data, resultList.total))
104} 108}
105 109
106async function listFollowers (req: express.Request, res: express.Response) { 110async function listFollowers (req: express.Request, res: express.Response) {
107 const serverActor = await getServerActor() 111 const serverActor = await getServerActor()
108 const resultList = await ActorFollowModel.listFollowersForApi( 112 const resultList = await ActorFollowModel.listFollowersForApi({
109 serverActor.id, 113 actorId: serverActor.id,
110 req.query.start, 114 start: req.query.start,
111 req.query.count, 115 count: req.query.count,
112 req.query.sort, 116 sort: req.query.sort,
113 req.query.search 117 search: req.query.search,
114 ) 118 state: req.query.state
119 })
115 120
116 return res.json(getFormattedObjects(resultList.data, resultList.total)) 121 return res.json(getFormattedObjects(resultList.data, resultList.total))
117} 122}