diff options
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/api/accounts.ts | 4 | ||||
-rw-r--r-- | server/controllers/api/video-channel.ts | 11 |
2 files changed, 11 insertions, 4 deletions
diff --git a/server/controllers/api/accounts.ts b/server/controllers/api/accounts.ts index 9eb29d330..e807b4f44 100644 --- a/server/controllers/api/accounts.ts +++ b/server/controllers/api/accounts.ts | |||
@@ -176,12 +176,12 @@ async function listAccountVideos (req: express.Request, res: express.Response) { | |||
176 | accountId: account.id, | 176 | accountId: account.id, |
177 | user: res.locals.oauth ? res.locals.oauth.token.User : undefined, | 177 | user: res.locals.oauth ? res.locals.oauth.token.User : undefined, |
178 | countVideos | 178 | countVideos |
179 | }, 'filter:api.videos.list.params') | 179 | }, 'filter:api.accounts.videos.list.params') |
180 | 180 | ||
181 | const resultList = await Hooks.wrapPromiseFun( | 181 | const resultList = await Hooks.wrapPromiseFun( |
182 | VideoModel.listForApi, | 182 | VideoModel.listForApi, |
183 | apiOptions, | 183 | apiOptions, |
184 | 'filter:api.videos.list.result' | 184 | 'filter:api.accounts.videos.list.result' |
185 | ) | 185 | ) |
186 | 186 | ||
187 | return res.json(getFormattedObjects(resultList.data, resultList.total)) | 187 | return res.json(getFormattedObjects(resultList.data, resultList.total)) |
diff --git a/server/controllers/api/video-channel.ts b/server/controllers/api/video-channel.ts index 5c96950c5..c48e00232 100644 --- a/server/controllers/api/video-channel.ts +++ b/server/controllers/api/video-channel.ts | |||
@@ -1,4 +1,5 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { Hooks } from '@server/lib/plugins/hooks' | ||
2 | import { getServerActor } from '@server/models/application/application' | 3 | import { getServerActor } from '@server/models/application/application' |
3 | import { MChannelAccountDefault } from '@server/types/models' | 4 | import { MChannelAccountDefault } from '@server/types/models' |
4 | import { VideoChannelCreate, VideoChannelUpdate } from '../../../shared' | 5 | import { VideoChannelCreate, VideoChannelUpdate } from '../../../shared' |
@@ -266,7 +267,7 @@ async function listVideoChannelVideos (req: express.Request, res: express.Respon | |||
266 | const followerActorId = isUserAbleToSearchRemoteURI(res) ? null : undefined | 267 | const followerActorId = isUserAbleToSearchRemoteURI(res) ? null : undefined |
267 | const countVideos = getCountVideos(req) | 268 | const countVideos = getCountVideos(req) |
268 | 269 | ||
269 | const resultList = await VideoModel.listForApi({ | 270 | const apiOptions = await Hooks.wrapObject({ |
270 | followerActorId, | 271 | followerActorId, |
271 | start: req.query.start, | 272 | start: req.query.start, |
272 | count: req.query.count, | 273 | count: req.query.count, |
@@ -283,7 +284,13 @@ async function listVideoChannelVideos (req: express.Request, res: express.Respon | |||
283 | videoChannelId: videoChannelInstance.id, | 284 | videoChannelId: videoChannelInstance.id, |
284 | user: res.locals.oauth ? res.locals.oauth.token.User : undefined, | 285 | user: res.locals.oauth ? res.locals.oauth.token.User : undefined, |
285 | countVideos | 286 | countVideos |
286 | }) | 287 | }, 'filter:api.video-channels.videos.list.params') |
288 | |||
289 | const resultList = await Hooks.wrapPromiseFun( | ||
290 | VideoModel.listForApi, | ||
291 | apiOptions, | ||
292 | 'filter:api.video-channels.videos.list.result' | ||
293 | ) | ||
287 | 294 | ||
288 | return res.json(getFormattedObjects(resultList.data, resultList.total)) | 295 | return res.json(getFormattedObjects(resultList.data, resultList.total)) |
289 | } | 296 | } |