aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/users/my-subscriptions.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-29 11:54:38 +0200
committerChocobozzz <me@florianbigard.com>2021-07-29 11:54:38 +0200
commitd6886027109af42be2e3ec5d14ad166199add11d (patch)
tree3a7603d36ff35a2d623d863f14ab93a2e1e6b7f2 /server/controllers/api/users/my-subscriptions.ts
parentb033851fb54241bb703f86add025229e68cc6f59 (diff)
downloadPeerTube-d6886027109af42be2e3ec5d14ad166199add11d.tar.gz
PeerTube-d6886027109af42be2e3ec5d14ad166199add11d.tar.zst
PeerTube-d6886027109af42be2e3ec5d14ad166199add11d.zip
Refactor search query options
Diffstat (limited to 'server/controllers/api/users/my-subscriptions.ts')
-rw-r--r--server/controllers/api/users/my-subscriptions.ts15
1 files changed, 4 insertions, 11 deletions
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 @@
1import 'multer' 1import 'multer'
2import * as express from 'express' 2import * as express from 'express'
3import { pickCommonVideoQuery } from '@server/helpers/query'
3import { sendUndoFollow } from '@server/lib/activitypub/send' 4import { sendUndoFollow } from '@server/lib/activitypub/send'
4import { VideoChannelModel } from '@server/models/video/video-channel' 5import { VideoChannelModel } from '@server/models/video/video-channel'
5import { VideosCommonQuery } from '@shared/models'
6import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' 6import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
7import { buildNSFWFilter, getCountVideos } from '../../../helpers/express-utils' 7import { buildNSFWFilter, getCountVideos } from '../../../helpers/express-utils'
8import { getFormattedObjects } from '../../../helpers/utils' 8import { getFormattedObjects } from '../../../helpers/utils'
@@ -170,20 +170,13 @@ 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 const query = pickCommonVideoQuery(req.query)
174 174
175 const resultList = await VideoModel.listForApi({ 175 const resultList = await VideoModel.listForApi({
176 start: query.start, 176 ...query,
177 count: query.count, 177
178 sort: query.sort,
179 includeLocalVideos: false, 178 includeLocalVideos: false,
180 categoryOneOf: query.categoryOneOf,
181 licenceOneOf: query.licenceOneOf,
182 languageOneOf: query.languageOneOf,
183 tagsOneOf: query.tagsOneOf,
184 tagsAllOf: query.tagsAllOf,
185 nsfw: buildNSFWFilter(res, query.nsfw), 179 nsfw: buildNSFWFilter(res, query.nsfw),
186 filter: query.filter,
187 withFiles: false, 180 withFiles: false,
188 followerActorId: user.Account.Actor.id, 181 followerActorId: user.Account.Actor.id,
189 user, 182 user,