aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
authorWicklow <wicklow@framasoft.org>2023-02-24 16:21:26 +0100
committerChocobozzz <chocobozzz@cpy.re>2023-02-25 15:47:48 +0100
commitc0687c91b9cf185c36e477ab30266c779f792ee1 (patch)
tree5c917b6b87b38eb89620ed21b114ac67c96a71d9 /server/controllers
parentd41f4a6dc69d098e9dc9173b7e1a586695ef7b97 (diff)
downloadPeerTube-c0687c91b9cf185c36e477ab30266c779f792ee1.tar.gz
PeerTube-c0687c91b9cf185c36e477ab30266c779f792ee1.tar.zst
PeerTube-c0687c91b9cf185c36e477ab30266c779f792ee1.zip
Add server hooks for listing subscription
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/api/users/my-subscriptions.ts11
1 files changed, 9 insertions, 2 deletions
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 {
30} from '../../../middlewares/validators' 30} from '../../../middlewares/validators'
31import { ActorFollowModel } from '../../../models/actor/actor-follow' 31import { ActorFollowModel } from '../../../models/actor/actor-follow'
32import { VideoModel } from '../../../models/video/video' 32import { VideoModel } from '../../../models/video/video'
33import { Hooks } from '@server/lib/plugins/hooks'
33 34
34const mySubscriptionsRouter = express.Router() 35const mySubscriptionsRouter = express.Router()
35 36
@@ -170,7 +171,7 @@ async function getUserSubscriptionVideos (req: express.Request, res: express.Res
170 const countVideos = getCountVideos(req) 171 const countVideos = getCountVideos(req)
171 const query = pickCommonVideoQuery(req.query) 172 const query = pickCommonVideoQuery(req.query)
172 173
173 const resultList = await VideoModel.listForApi({ 174 const apiOptions = await Hooks.wrapObject({
174 ...query, 175 ...query,
175 176
176 displayOnlyForFollower: { 177 displayOnlyForFollower: {
@@ -180,7 +181,13 @@ async function getUserSubscriptionVideos (req: express.Request, res: express.Res
180 nsfw: buildNSFWFilter(res, query.nsfw), 181 nsfw: buildNSFWFilter(res, query.nsfw),
181 user, 182 user,
182 countVideos 183 countVideos
183 }) 184 }, 'filter:api.user.me.subscription-videos.list.params')
185
186 const resultList = await Hooks.wrapPromiseFun(
187 VideoModel.listForApi,
188 apiOptions,
189 'filter:api.user.me.subscription-videos.list.result'
190 )
184 191
185 return res.json(getFormattedObjects(resultList.data, resultList.total, guessAdditionalAttributesFromQuery(query))) 192 return res.json(getFormattedObjects(resultList.data, resultList.total, guessAdditionalAttributesFromQuery(query)))
186} 193}