diff options
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/api/users/my-subscriptions.ts | 11 |
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' |
31 | import { ActorFollowModel } from '../../../models/actor/actor-follow' | 31 | import { ActorFollowModel } from '../../../models/actor/actor-follow' |
32 | import { VideoModel } from '../../../models/video/video' | 32 | import { VideoModel } from '../../../models/video/video' |
33 | import { Hooks } from '@server/lib/plugins/hooks' | ||
33 | 34 | ||
34 | const mySubscriptionsRouter = express.Router() | 35 | const 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 | } |