mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-02-25 18:55:32 -06:00
Add hook filters tests
This commit is contained in:
@@ -85,8 +85,9 @@ async function listVideoThreads (req: express.Request, res: express.Response) {
|
||||
user: user
|
||||
}, 'filter:api.video-threads.list.params')
|
||||
|
||||
resultList = await Hooks.wrapPromise(
|
||||
VideoCommentModel.listThreadsForApi(apiOptions),
|
||||
resultList = await Hooks.wrapPromiseFun(
|
||||
VideoCommentModel.listThreadsForApi,
|
||||
apiOptions,
|
||||
'filter:api.video-threads.list.result'
|
||||
)
|
||||
} else {
|
||||
@@ -112,8 +113,9 @@ async function listVideoThreadComments (req: express.Request, res: express.Respo
|
||||
user: user
|
||||
}, 'filter:api.video-thread-comments.list.params')
|
||||
|
||||
resultList = await Hooks.wrapPromise(
|
||||
VideoCommentModel.listThreadCommentsForApi(apiOptions),
|
||||
resultList = await Hooks.wrapPromiseFun(
|
||||
VideoCommentModel.listThreadCommentsForApi,
|
||||
apiOptions,
|
||||
'filter:api.video-thread-comments.list.result'
|
||||
)
|
||||
} else {
|
||||
|
||||
@@ -436,8 +436,9 @@ async function getVideo (req: express.Request, res: express.Response) {
|
||||
// We need more attributes
|
||||
const userId: number = res.locals.oauth ? res.locals.oauth.token.User.id : null
|
||||
|
||||
const video = await Hooks.wrapPromise(
|
||||
VideoModel.loadForGetAPI(res.locals.video.id, undefined, userId),
|
||||
const video = await Hooks.wrapPromiseFun(
|
||||
VideoModel.loadForGetAPI,
|
||||
{ id: res.locals.video.id, userId },
|
||||
'filter:api.video.get.result'
|
||||
)
|
||||
|
||||
@@ -502,8 +503,9 @@ async function listVideos (req: express.Request, res: express.Response) {
|
||||
user: res.locals.oauth ? res.locals.oauth.token.User : undefined
|
||||
}, 'filter:api.videos.list.params')
|
||||
|
||||
const resultList = await Hooks.wrapPromise(
|
||||
VideoModel.listForApi(apiOptions),
|
||||
const resultList = await Hooks.wrapPromiseFun(
|
||||
VideoModel.listForApi,
|
||||
apiOptions,
|
||||
'filter:api.videos.list.result'
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user