aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
authorkontrollanten <6680299+kontrollanten@users.noreply.github.com>2020-12-03 17:18:56 +0100
committerChocobozzz <chocobozzz@cpy.re>2020-12-08 10:33:23 +0100
commit1bfc07e4cca1464c87c317060eb86742344467a6 (patch)
tree006882fd7ef9ab285ad3e17dd26ec96178dcd004 /server/controllers
parent05e85b59c7e9b0e9892f326cd0bcc78630004429 (diff)
downloadPeerTube-1bfc07e4cca1464c87c317060eb86742344467a6.tar.gz
PeerTube-1bfc07e4cca1464c87c317060eb86742344467a6.tar.zst
PeerTube-1bfc07e4cca1464c87c317060eb86742344467a6.zip
server accounts/videos: trigger filter hook
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/api/accounts.ts11
1 files changed, 9 insertions, 2 deletions
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'
2import { getServerActor } from '@server/models/application/application' 2import { getServerActor } from '@server/models/application/application'
3import { buildNSFWFilter, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils' 3import { buildNSFWFilter, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils'
4import { getFormattedObjects } from '../../helpers/utils' 4import { getFormattedObjects } from '../../helpers/utils'
5import { Hooks } from '../../lib/plugins/hooks'
5import { JobQueue } from '../../lib/job-queue' 6import { JobQueue } from '../../lib/job-queue'
6import { 7import {
7 asyncMiddleware, 8 asyncMiddleware,
@@ -158,7 +159,7 @@ async function listAccountVideos (req: express.Request, res: express.Response) {
158 const followerActorId = isUserAbleToSearchRemoteURI(res) ? null : undefined 159 const followerActorId = isUserAbleToSearchRemoteURI(res) ? null : undefined
159 const countVideos = getCountVideos(req) 160 const countVideos = getCountVideos(req)
160 161
161 const resultList = await VideoModel.listForApi({ 162 const apiOptions = await Hooks.wrapObject({
162 followerActorId, 163 followerActorId,
163 start: req.query.start, 164 start: req.query.start,
164 count: req.query.count, 165 count: req.query.count,
@@ -175,7 +176,13 @@ async function listAccountVideos (req: express.Request, res: express.Response) {
175 accountId: account.id, 176 accountId: account.id,
176 user: res.locals.oauth ? res.locals.oauth.token.User : undefined, 177 user: res.locals.oauth ? res.locals.oauth.token.User : undefined,
177 countVideos 178 countVideos
178 }) 179 }, 'filter:api.videos.list.params')
180
181 const resultList = await Hooks.wrapPromiseFun(
182 VideoModel.listForApi,
183 apiOptions,
184 'filter:api.videos.list.result'
185 )
179 186
180 return res.json(getFormattedObjects(resultList.data, resultList.total)) 187 return res.json(getFormattedObjects(resultList.data, resultList.total))
181} 188}