aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/video-channel.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-12-08 10:30:33 +0100
committerChocobozzz <chocobozzz@cpy.re>2020-12-08 10:33:23 +0100
commit38267c0c8aa80f974a2c0b4c2bd33c8d8008ac94 (patch)
treedd99242abdd5a02de272be0f06ecfe03edadc575 /server/controllers/api/video-channel.ts
parent1bfc07e4cca1464c87c317060eb86742344467a6 (diff)
downloadPeerTube-38267c0c8aa80f974a2c0b4c2bd33c8d8008ac94.tar.gz
PeerTube-38267c0c8aa80f974a2c0b4c2bd33c8d8008ac94.tar.zst
PeerTube-38267c0c8aa80f974a2c0b4c2bd33c8d8008ac94.zip
Use dedicated hooks for account/channel videos
Diffstat (limited to 'server/controllers/api/video-channel.ts')
-rw-r--r--server/controllers/api/video-channel.ts11
1 files changed, 9 insertions, 2 deletions
diff --git a/server/controllers/api/video-channel.ts b/server/controllers/api/video-channel.ts
index 5c96950c5..c48e00232 100644
--- a/server/controllers/api/video-channel.ts
+++ b/server/controllers/api/video-channel.ts
@@ -1,4 +1,5 @@
1import * as express from 'express' 1import * as express from 'express'
2import { Hooks } from '@server/lib/plugins/hooks'
2import { getServerActor } from '@server/models/application/application' 3import { getServerActor } from '@server/models/application/application'
3import { MChannelAccountDefault } from '@server/types/models' 4import { MChannelAccountDefault } from '@server/types/models'
4import { VideoChannelCreate, VideoChannelUpdate } from '../../../shared' 5import { VideoChannelCreate, VideoChannelUpdate } from '../../../shared'
@@ -266,7 +267,7 @@ async function listVideoChannelVideos (req: express.Request, res: express.Respon
266 const followerActorId = isUserAbleToSearchRemoteURI(res) ? null : undefined 267 const followerActorId = isUserAbleToSearchRemoteURI(res) ? null : undefined
267 const countVideos = getCountVideos(req) 268 const countVideos = getCountVideos(req)
268 269
269 const resultList = await VideoModel.listForApi({ 270 const apiOptions = await Hooks.wrapObject({
270 followerActorId, 271 followerActorId,
271 start: req.query.start, 272 start: req.query.start,
272 count: req.query.count, 273 count: req.query.count,
@@ -283,7 +284,13 @@ async function listVideoChannelVideos (req: express.Request, res: express.Respon
283 videoChannelId: videoChannelInstance.id, 284 videoChannelId: videoChannelInstance.id,
284 user: res.locals.oauth ? res.locals.oauth.token.User : undefined, 285 user: res.locals.oauth ? res.locals.oauth.token.User : undefined,
285 countVideos 286 countVideos
286 }) 287 }, 'filter:api.video-channels.videos.list.params')
288
289 const resultList = await Hooks.wrapPromiseFun(
290 VideoModel.listForApi,
291 apiOptions,
292 'filter:api.video-channels.videos.list.result'
293 )
287 294
288 return res.json(getFormattedObjects(resultList.data, resultList.total)) 295 return res.json(getFormattedObjects(resultList.data, resultList.total))
289} 296}