aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/accounts.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/accounts.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/accounts.ts')
-rw-r--r--server/controllers/api/accounts.ts6
1 files changed, 4 insertions, 2 deletions
diff --git a/server/controllers/api/accounts.ts b/server/controllers/api/accounts.ts
index c49da3c0a..00148ff55 100644
--- a/server/controllers/api/accounts.ts
+++ b/server/controllers/api/accounts.ts
@@ -22,7 +22,7 @@ import {
22import { AccountModel } from '../../models/account/account' 22import { AccountModel } from '../../models/account/account'
23import { AccountVideoRateModel } from '../../models/account/account-video-rate' 23import { AccountVideoRateModel } from '../../models/account/account-video-rate'
24import { VideoModel } from '../../models/video/video' 24import { VideoModel } from '../../models/video/video'
25import { buildNSFWFilter, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils' 25import { buildNSFWFilter, isUserAbleToSearchRemoteURI, getCountVideos } from '../../helpers/express-utils'
26import { VideoChannelModel } from '../../models/video/video-channel' 26import { VideoChannelModel } from '../../models/video/video-channel'
27import { JobQueue } from '../../lib/job-queue' 27import { JobQueue } from '../../lib/job-queue'
28import { logger } from '../../helpers/logger' 28import { logger } from '../../helpers/logger'
@@ -155,6 +155,7 @@ async function listAccountPlaylists (req: express.Request, res: express.Response
155async function listAccountVideos (req: express.Request, res: express.Response) { 155async function listAccountVideos (req: express.Request, res: express.Response) {
156 const account = res.locals.account 156 const account = res.locals.account
157 const followerActorId = isUserAbleToSearchRemoteURI(res) ? null : undefined 157 const followerActorId = isUserAbleToSearchRemoteURI(res) ? null : undefined
158 const countVideos = getCountVideos(req)
158 159
159 const resultList = await VideoModel.listForApi({ 160 const resultList = await VideoModel.listForApi({
160 followerActorId, 161 followerActorId,
@@ -171,7 +172,8 @@ async function listAccountVideos (req: express.Request, res: express.Response) {
171 nsfw: buildNSFWFilter(res, req.query.nsfw), 172 nsfw: buildNSFWFilter(res, req.query.nsfw),
172 withFiles: false, 173 withFiles: false,
173 accountId: account.id, 174 accountId: account.id,
174 user: res.locals.oauth ? res.locals.oauth.token.User : undefined 175 user: res.locals.oauth ? res.locals.oauth.token.User : undefined,
176 countVideos
175 }) 177 })
176 178
177 return res.json(getFormattedObjects(resultList.data, resultList.total)) 179 return res.json(getFormattedObjects(resultList.data, resultList.total))