aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/users
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-05-03 11:06:19 +0200
committerChocobozzz <me@florianbigard.com>2021-05-03 16:42:15 +0200
commit1fd61899eaea245a5844e33e21f04b2562f16e5e (patch)
tree2a1d51b37b12219cade35e189d62686cd0fec105 /server/controllers/api/users
parentdfcb6f50a607b6b402b4f8fa3d43792d61c912a5 (diff)
downloadPeerTube-1fd61899eaea245a5844e33e21f04b2562f16e5e.tar.gz
PeerTube-1fd61899eaea245a5844e33e21f04b2562f16e5e.tar.zst
PeerTube-1fd61899eaea245a5844e33e21f04b2562f16e5e.zip
Add ability to filter my videos by live
Diffstat (limited to 'server/controllers/api/users')
-rw-r--r--server/controllers/api/users/me.ts3
-rw-r--r--server/controllers/api/users/my-subscriptions.ts23
2 files changed, 14 insertions, 12 deletions
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) {
111 start: req.query.start, 111 start: req.query.start,
112 count: req.query.count, 112 count: req.query.count,
113 sort: req.query.sort, 113 sort: req.query.sort,
114 search: req.query.search 114 search: req.query.search,
115 isLive: req.query.isLive
115 }, 'filter:api.user.me.videos.list.params') 116 }, 'filter:api.user.me.videos.list.params')
116 117
117 const resultList = await Hooks.wrapPromiseFun( 118 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'
2import * as express from 'express' 2import * as express from 'express'
3import { sendUndoFollow } from '@server/lib/activitypub/send' 3import { sendUndoFollow } from '@server/lib/activitypub/send'
4import { VideoChannelModel } from '@server/models/video/video-channel' 4import { VideoChannelModel } from '@server/models/video/video-channel'
5import { VideosCommonQuery } from '@shared/models'
5import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' 6import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
6import { VideoFilter } from '../../../../shared/models/videos/video-query.type'
7import { buildNSFWFilter, getCountVideos } from '../../../helpers/express-utils' 7import { buildNSFWFilter, getCountVideos } from '../../../helpers/express-utils'
8import { getFormattedObjects } from '../../../helpers/utils' 8import { getFormattedObjects } from '../../../helpers/utils'
9import { WEBSERVER } from '../../../initializers/constants' 9import { WEBSERVER } from '../../../initializers/constants'
@@ -170,19 +170,20 @@ async function getUserSubscriptions (req: express.Request, res: express.Response
170async function getUserSubscriptionVideos (req: express.Request, res: express.Response) { 170async function getUserSubscriptionVideos (req: express.Request, res: express.Response) {
171 const user = res.locals.oauth.token.User 171 const user = res.locals.oauth.token.User
172 const countVideos = getCountVideos(req) 172 const countVideos = getCountVideos(req)
173 const query = req.query as VideosCommonQuery
173 174
174 const resultList = await VideoModel.listForApi({ 175 const resultList = await VideoModel.listForApi({
175 start: req.query.start, 176 start: query.start,
176 count: req.query.count, 177 count: query.count,
177 sort: req.query.sort, 178 sort: query.sort,
178 includeLocalVideos: false, 179 includeLocalVideos: false,
179 categoryOneOf: req.query.categoryOneOf, 180 categoryOneOf: query.categoryOneOf,
180 licenceOneOf: req.query.licenceOneOf, 181 licenceOneOf: query.licenceOneOf,
181 languageOneOf: req.query.languageOneOf, 182 languageOneOf: query.languageOneOf,
182 tagsOneOf: req.query.tagsOneOf, 183 tagsOneOf: query.tagsOneOf,
183 tagsAllOf: req.query.tagsAllOf, 184 tagsAllOf: query.tagsAllOf,
184 nsfw: buildNSFWFilter(res, req.query.nsfw), 185 nsfw: buildNSFWFilter(res, query.nsfw),
185 filter: req.query.filter as VideoFilter, 186 filter: query.filter,
186 withFiles: false, 187 withFiles: false,
187 followerActorId: user.Account.Actor.id, 188 followerActorId: user.Account.Actor.id,
188 user, 189 user,