From c0687c91b9cf185c36e477ab30266c779f792ee1 Mon Sep 17 00:00:00 2001 From: Wicklow Date: Fri, 24 Feb 2023 16:21:26 +0100 Subject: Add server hooks for listing subscription --- server/controllers/api/users/my-subscriptions.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'server/controllers/api/users') diff --git a/server/controllers/api/users/my-subscriptions.ts b/server/controllers/api/users/my-subscriptions.ts index 6c64e99a7..6ba8ba597 100644 --- a/server/controllers/api/users/my-subscriptions.ts +++ b/server/controllers/api/users/my-subscriptions.ts @@ -30,6 +30,7 @@ import { } from '../../../middlewares/validators' import { ActorFollowModel } from '../../../models/actor/actor-follow' import { VideoModel } from '../../../models/video/video' +import { Hooks } from '@server/lib/plugins/hooks' const mySubscriptionsRouter = express.Router() @@ -170,7 +171,7 @@ async function getUserSubscriptionVideos (req: express.Request, res: express.Res const countVideos = getCountVideos(req) const query = pickCommonVideoQuery(req.query) - const resultList = await VideoModel.listForApi({ + const apiOptions = await Hooks.wrapObject({ ...query, displayOnlyForFollower: { @@ -180,7 +181,13 @@ async function getUserSubscriptionVideos (req: express.Request, res: express.Res nsfw: buildNSFWFilter(res, query.nsfw), user, countVideos - }) + }, 'filter:api.user.me.subscription-videos.list.params') + + const resultList = await Hooks.wrapPromiseFun( + VideoModel.listForApi, + apiOptions, + 'filter:api.user.me.subscription-videos.list.result' + ) return res.json(getFormattedObjects(resultList.data, resultList.total, guessAdditionalAttributesFromQuery(query))) } -- cgit v1.2.3