From 1fd61899eaea245a5844e33e21f04b2562f16e5e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 3 May 2021 11:06:19 +0200 Subject: Add ability to filter my videos by live --- server/controllers/api/users/me.ts | 3 ++- server/controllers/api/users/my-subscriptions.ts | 23 ++++++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) (limited to 'server/controllers/api/users') diff --git a/server/controllers/api/users/me.ts b/server/controllers/api/users/me.ts index 9f9d2d77f..0763d1900 100644 --- a/server/controllers/api/users/me.ts +++ b/server/controllers/api/users/me.ts @@ -111,7 +111,8 @@ async function getUserVideos (req: express.Request, res: express.Response) { start: req.query.start, count: req.query.count, sort: req.query.sort, - search: req.query.search + search: req.query.search, + isLive: req.query.isLive }, 'filter:api.user.me.videos.list.params') const resultList = await Hooks.wrapPromiseFun( diff --git a/server/controllers/api/users/my-subscriptions.ts b/server/controllers/api/users/my-subscriptions.ts index e8949ee59..56b93276f 100644 --- a/server/controllers/api/users/my-subscriptions.ts +++ b/server/controllers/api/users/my-subscriptions.ts @@ -2,8 +2,8 @@ import 'multer' import * as express from 'express' import { sendUndoFollow } from '@server/lib/activitypub/send' import { VideoChannelModel } from '@server/models/video/video-channel' +import { VideosCommonQuery } from '@shared/models' import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' -import { VideoFilter } from '../../../../shared/models/videos/video-query.type' import { buildNSFWFilter, getCountVideos } from '../../../helpers/express-utils' import { getFormattedObjects } from '../../../helpers/utils' import { WEBSERVER } from '../../../initializers/constants' @@ -170,19 +170,20 @@ 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 resultList = await VideoModel.listForApi({ - start: req.query.start, - count: req.query.count, - sort: req.query.sort, + start: query.start, + count: query.count, + sort: query.sort, includeLocalVideos: false, - categoryOneOf: req.query.categoryOneOf, - licenceOneOf: req.query.licenceOneOf, - languageOneOf: req.query.languageOneOf, - tagsOneOf: req.query.tagsOneOf, - tagsAllOf: req.query.tagsAllOf, - nsfw: buildNSFWFilter(res, req.query.nsfw), - filter: req.query.filter as VideoFilter, + 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