diff options
author | Chocobozzz <me@florianbigard.com> | 2020-01-08 14:15:16 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-01-08 14:15:16 +0100 |
commit | fe98765624cdd6695739bda719fcb726b71c2b2a (patch) | |
tree | 18b19d427e5c25fc9e5290062f307e668f4c9e45 /server/controllers/api/video-channel.ts | |
parent | ddc07312b041c1c533b68a919681fc9bce83430d (diff) | |
download | PeerTube-fe98765624cdd6695739bda719fcb726b71c2b2a.tar.gz PeerTube-fe98765624cdd6695739bda719fcb726b71c2b2a.tar.zst PeerTube-fe98765624cdd6695739bda719fcb726b71c2b2a.zip |
Add ability to skip count query
Diffstat (limited to 'server/controllers/api/video-channel.ts')
-rw-r--r-- | server/controllers/api/video-channel.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/server/controllers/api/video-channel.ts b/server/controllers/api/video-channel.ts index acc5b2987..e1f37a8fb 100644 --- a/server/controllers/api/video-channel.ts +++ b/server/controllers/api/video-channel.ts | |||
@@ -20,7 +20,7 @@ import { videoChannelsNameWithHostValidator, videosSortValidator } from '../../m | |||
20 | import { sendUpdateActor } from '../../lib/activitypub/send' | 20 | import { sendUpdateActor } from '../../lib/activitypub/send' |
21 | import { VideoChannelCreate, VideoChannelUpdate } from '../../../shared' | 21 | import { VideoChannelCreate, VideoChannelUpdate } from '../../../shared' |
22 | import { createLocalVideoChannel, federateAllVideosOfChannel } from '../../lib/video-channel' | 22 | import { createLocalVideoChannel, federateAllVideosOfChannel } from '../../lib/video-channel' |
23 | import { buildNSFWFilter, createReqFiles, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils' | 23 | import { buildNSFWFilter, createReqFiles, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils' |
24 | import { setAsyncActorKeys } from '../../lib/activitypub' | 24 | import { setAsyncActorKeys } from '../../lib/activitypub' |
25 | import { AccountModel } from '../../models/account/account' | 25 | import { AccountModel } from '../../models/account/account' |
26 | import { MIMETYPES } from '../../initializers/constants' | 26 | import { MIMETYPES } from '../../initializers/constants' |
@@ -256,6 +256,7 @@ async function listVideoChannelPlaylists (req: express.Request, res: express.Res | |||
256 | async function listVideoChannelVideos (req: express.Request, res: express.Response) { | 256 | async function listVideoChannelVideos (req: express.Request, res: express.Response) { |
257 | const videoChannelInstance = res.locals.videoChannel | 257 | const videoChannelInstance = res.locals.videoChannel |
258 | const followerActorId = isUserAbleToSearchRemoteURI(res) ? null : undefined | 258 | const followerActorId = isUserAbleToSearchRemoteURI(res) ? null : undefined |
259 | const countVideos = getCountVideos(req) | ||
259 | 260 | ||
260 | const resultList = await VideoModel.listForApi({ | 261 | const resultList = await VideoModel.listForApi({ |
261 | followerActorId, | 262 | followerActorId, |
@@ -272,7 +273,8 @@ async function listVideoChannelVideos (req: express.Request, res: express.Respon | |||
272 | nsfw: buildNSFWFilter(res, req.query.nsfw), | 273 | nsfw: buildNSFWFilter(res, req.query.nsfw), |
273 | withFiles: false, | 274 | withFiles: false, |
274 | videoChannelId: videoChannelInstance.id, | 275 | videoChannelId: videoChannelInstance.id, |
275 | user: res.locals.oauth ? res.locals.oauth.token.User : undefined | 276 | user: res.locals.oauth ? res.locals.oauth.token.User : undefined, |
277 | countVideos | ||
276 | }) | 278 | }) |
277 | 279 | ||
278 | return res.json(getFormattedObjects(resultList.data, resultList.total)) | 280 | return res.json(getFormattedObjects(resultList.data, resultList.total)) |