X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fcontrollers%2Fapi%2Faccounts.ts;h=75679b0f44a0bbc1b0f0f067cdb148570578584a;hb=f82416cc58f6c1d0496935e815f3fcb2fdda88ea;hp=e31924a9410b5d87acfccf3d45a9aeedb954daff;hpb=370240824e2fb28b314255f6c23f5ea7d6b08625;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/controllers/api/accounts.ts b/server/controllers/api/accounts.ts index e31924a94..75679b0f4 100644 --- a/server/controllers/api/accounts.ts +++ b/server/controllers/api/accounts.ts @@ -1,9 +1,10 @@ -import * as express from 'express' +import express from 'express' +import { pickCommonVideoQuery } from '@server/helpers/query' 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 { Hooks } from '../../lib/plugins/hooks' import { asyncMiddleware, authenticate, @@ -158,25 +159,19 @@ async function listAccountVideos (req: express.Request, res: express.Response) { const account = res.locals.account const followerActorId = isUserAbleToSearchRemoteURI(res) ? null : undefined const countVideos = getCountVideos(req) + const query = pickCommonVideoQuery(req.query) const apiOptions = await Hooks.wrapObject({ + ...query, + followerActorId, - start: req.query.start, - count: req.query.count, - sort: req.query.sort, + search: req.query.search, includeLocalVideos: true, - categoryOneOf: req.query.categoryOneOf, - licenceOneOf: req.query.licenceOneOf, - languageOneOf: req.query.languageOneOf, - tagsOneOf: req.query.tagsOneOf, - tagsAllOf: req.query.tagsAllOf, - filter: req.query.filter, - nsfw: buildNSFWFilter(res, req.query.nsfw), + nsfw: buildNSFWFilter(res, query.nsfw), withFiles: false, accountId: account.id, user: res.locals.oauth ? res.locals.oauth.token.User : undefined, - countVideos, - search: req.query.search + countVideos }, 'filter:api.accounts.videos.list.params') const resultList = await Hooks.wrapPromiseFun(