From 1bfc07e4cca1464c87c317060eb86742344467a6 Mon Sep 17 00:00:00 2001 From: kontrollanten <6680299+kontrollanten@users.noreply.github.com> Date: Thu, 3 Dec 2020 17:18:56 +0100 Subject: server accounts/videos: trigger filter hook --- server/controllers/api/accounts.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'server') diff --git a/server/controllers/api/accounts.ts b/server/controllers/api/accounts.ts index 0a73dfcbf..9eb29d330 100644 --- a/server/controllers/api/accounts.ts +++ b/server/controllers/api/accounts.ts @@ -2,6 +2,7 @@ import * as express from 'express' import { getServerActor } from '@server/models/application/application' import { buildNSFWFilter, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils' import { getFormattedObjects } from '../../helpers/utils' +import { Hooks } from '../../lib/plugins/hooks' import { JobQueue } from '../../lib/job-queue' import { asyncMiddleware, @@ -158,7 +159,7 @@ async function listAccountVideos (req: express.Request, res: express.Response) { 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, @@ -175,7 +176,13 @@ async function listAccountVideos (req: express.Request, res: express.Response) { accountId: account.id, user: res.locals.oauth ? res.locals.oauth.token.User : undefined, countVideos - }) + }, 'filter:api.videos.list.params') + + const resultList = await Hooks.wrapPromiseFun( + VideoModel.listForApi, + apiOptions, + 'filter:api.videos.list.result' + ) return res.json(getFormattedObjects(resultList.data, resultList.total)) } -- cgit v1.2.3