From 89cd12756035a146bbcc4db78cd3cd64f2f3d88d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 19 Jul 2019 17:30:41 +0200 Subject: Add hook filters tests --- server/controllers/api/videos/index.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'server/controllers/api/videos/index.ts') diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index a3b1dde29..11e468df2 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts @@ -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' ) -- cgit v1.2.3