aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/users/my-subscriptions.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-01-08 14:15:16 +0100
committerChocobozzz <me@florianbigard.com>2020-01-08 14:15:16 +0100
commitfe98765624cdd6695739bda719fcb726b71c2b2a (patch)
tree18b19d427e5c25fc9e5290062f307e668f4c9e45 /server/controllers/api/users/my-subscriptions.ts
parentddc07312b041c1c533b68a919681fc9bce83430d (diff)
downloadPeerTube-fe98765624cdd6695739bda719fcb726b71c2b2a.tar.gz
PeerTube-fe98765624cdd6695739bda719fcb726b71c2b2a.tar.zst
PeerTube-fe98765624cdd6695739bda719fcb726b71c2b2a.zip
Add ability to skip count query
Diffstat (limited to 'server/controllers/api/users/my-subscriptions.ts')
-rw-r--r--server/controllers/api/users/my-subscriptions.ts7
1 files changed, 5 insertions, 2 deletions
diff --git a/server/controllers/api/users/my-subscriptions.ts b/server/controllers/api/users/my-subscriptions.ts
index c52df3154..43c4c37d8 100644
--- a/server/controllers/api/users/my-subscriptions.ts
+++ b/server/controllers/api/users/my-subscriptions.ts
@@ -15,7 +15,7 @@ import {
15} from '../../../middlewares' 15} from '../../../middlewares'
16import { areSubscriptionsExistValidator, userSubscriptionsSortValidator, videosSortValidator } from '../../../middlewares/validators' 16import { areSubscriptionsExistValidator, userSubscriptionsSortValidator, videosSortValidator } from '../../../middlewares/validators'
17import { VideoModel } from '../../../models/video/video' 17import { VideoModel } from '../../../models/video/video'
18import { buildNSFWFilter } from '../../../helpers/express-utils' 18import { buildNSFWFilter, getCountVideos } from '../../../helpers/express-utils'
19import { VideoFilter } from '../../../../shared/models/videos/video-query.type' 19import { VideoFilter } from '../../../../shared/models/videos/video-query.type'
20import { ActorFollowModel } from '../../../models/activitypub/actor-follow' 20import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
21import { JobQueue } from '../../../lib/job-queue' 21import { JobQueue } from '../../../lib/job-queue'
@@ -149,6 +149,8 @@ async function getUserSubscriptions (req: express.Request, res: express.Response
149 149
150async function getUserSubscriptionVideos (req: express.Request, res: express.Response) { 150async function getUserSubscriptionVideos (req: express.Request, res: express.Response) {
151 const user = res.locals.oauth.token.User 151 const user = res.locals.oauth.token.User
152 const countVideos = getCountVideos(req)
153
152 const resultList = await VideoModel.listForApi({ 154 const resultList = await VideoModel.listForApi({
153 start: req.query.start, 155 start: req.query.start,
154 count: req.query.count, 156 count: req.query.count,
@@ -163,7 +165,8 @@ async function getUserSubscriptionVideos (req: express.Request, res: express.Res
163 filter: req.query.filter as VideoFilter, 165 filter: req.query.filter as VideoFilter,
164 withFiles: false, 166 withFiles: false,
165 followerActorId: user.Account.Actor.id, 167 followerActorId: user.Account.Actor.id,
166 user 168 user,
169 countVideos
167 }) 170 })
168 171
169 return res.json(getFormattedObjects(resultList.data, resultList.total)) 172 return res.json(getFormattedObjects(resultList.data, resultList.total))