mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 19:42:24 +02:00
Use dedicated hooks for account/channel videos
This commit is contained in:
parent
1bfc07e4cc
commit
38267c0c8a
5 changed files with 74 additions and 8 deletions
|
@ -1,4 +1,5 @@
|
|||
import * as express from 'express'
|
||||
import { Hooks } from '@server/lib/plugins/hooks'
|
||||
import { getServerActor } from '@server/models/application/application'
|
||||
import { MChannelAccountDefault } from '@server/types/models'
|
||||
import { VideoChannelCreate, VideoChannelUpdate } from '../../../shared'
|
||||
|
@ -266,7 +267,7 @@ async function listVideoChannelVideos (req: express.Request, res: express.Respon
|
|||
const followerActorId = isUserAbleToSearchRemoteURI(res) ? null : undefined
|
||||
const countVideos = getCountVideos(req)
|
||||
|
||||
const resultList = await VideoModel.listForApi({
|
||||
const apiOptions = await Hooks.wrapObject({
|
||||
followerActorId,
|
||||
start: req.query.start,
|
||||
count: req.query.count,
|
||||
|
@ -283,7 +284,13 @@ async function listVideoChannelVideos (req: express.Request, res: express.Respon
|
|||
videoChannelId: videoChannelInstance.id,
|
||||
user: res.locals.oauth ? res.locals.oauth.token.User : undefined,
|
||||
countVideos
|
||||
})
|
||||
}, 'filter:api.video-channels.videos.list.params')
|
||||
|
||||
const resultList = await Hooks.wrapPromiseFun(
|
||||
VideoModel.listForApi,
|
||||
apiOptions,
|
||||
'filter:api.video-channels.videos.list.result'
|
||||
)
|
||||
|
||||
return res.json(getFormattedObjects(resultList.data, resultList.total))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue