From b8f4167fb6fa448125aeecff80b201d74e27fe6a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 28 Nov 2019 11:37:32 +0100 Subject: Only display accepted followers/followings in about page --- server/controllers/api/server/follows.ts | 35 ++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 15 deletions(-) (limited to 'server/controllers/api') 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 { followingSortValidator, followValidator, getFollowerValidator, - removeFollowingValidator + removeFollowingValidator, + listFollowsValidator } from '../../../middlewares/validators' import { ActorFollowModel } from '../../../models/activitypub/actor-follow' import { JobQueue } from '../../../lib/job-queue' @@ -29,6 +30,7 @@ import { autoFollowBackIfNeeded } from '../../../lib/activitypub/follow' const serverFollowsRouter = express.Router() serverFollowsRouter.get('/following', + listFollowsValidator, paginationValidator, followingSortValidator, setDefaultSort, @@ -52,6 +54,7 @@ serverFollowsRouter.delete('/following/:host', ) serverFollowsRouter.get('/followers', + listFollowsValidator, paginationValidator, followersSortValidator, setDefaultSort, @@ -92,26 +95,28 @@ export { async function listFollowing (req: express.Request, res: express.Response) { const serverActor = await getServerActor() - const resultList = await ActorFollowModel.listFollowingForApi( - serverActor.id, - req.query.start, - req.query.count, - req.query.sort, - req.query.search - ) + const resultList = await ActorFollowModel.listFollowingForApi({ + id: serverActor.id, + start: req.query.start, + count: req.query.count, + sort: req.query.sort, + search: req.query.search, + state: req.query.state + }) return res.json(getFormattedObjects(resultList.data, resultList.total)) } async function listFollowers (req: express.Request, res: express.Response) { const serverActor = await getServerActor() - const resultList = await ActorFollowModel.listFollowersForApi( - serverActor.id, - req.query.start, - req.query.count, - req.query.sort, - req.query.search - ) + const resultList = await ActorFollowModel.listFollowersForApi({ + actorId: serverActor.id, + start: req.query.start, + count: req.query.count, + sort: req.query.sort, + search: req.query.search, + state: req.query.state + }) return res.json(getFormattedObjects(resultList.data, resultList.total)) } -- cgit v1.2.3