From d6886027109af42be2e3ec5d14ad166199add11d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 29 Jul 2021 11:54:38 +0200 Subject: Refactor search query options --- server/controllers/api/users/my-subscriptions.ts | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'server/controllers/api/users/my-subscriptions.ts') diff --git a/server/controllers/api/users/my-subscriptions.ts b/server/controllers/api/users/my-subscriptions.ts index 84f519926..26a715704 100644 --- a/server/controllers/api/users/my-subscriptions.ts +++ b/server/controllers/api/users/my-subscriptions.ts @@ -1,8 +1,8 @@ import 'multer' import * as express from 'express' +import { pickCommonVideoQuery } from '@server/helpers/query' import { sendUndoFollow } from '@server/lib/activitypub/send' import { VideoChannelModel } from '@server/models/video/video-channel' -import { VideosCommonQuery } from '@shared/models' import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' import { buildNSFWFilter, getCountVideos } from '../../../helpers/express-utils' import { getFormattedObjects } from '../../../helpers/utils' @@ -170,20 +170,13 @@ async function getUserSubscriptions (req: express.Request, res: express.Response async function getUserSubscriptionVideos (req: express.Request, res: express.Response) { const user = res.locals.oauth.token.User const countVideos = getCountVideos(req) - const query = req.query as VideosCommonQuery + const query = pickCommonVideoQuery(req.query) const resultList = await VideoModel.listForApi({ - start: query.start, - count: query.count, - sort: query.sort, + ...query, + includeLocalVideos: false, - categoryOneOf: query.categoryOneOf, - licenceOneOf: query.licenceOneOf, - languageOneOf: query.languageOneOf, - tagsOneOf: query.tagsOneOf, - tagsAllOf: query.tagsAllOf, nsfw: buildNSFWFilter(res, query.nsfw), - filter: query.filter, withFiles: false, followerActorId: user.Account.Actor.id, user, -- cgit v1.2.3