aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/video-channel.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-10-27 14:37:04 +0200
committerChocobozzz <chocobozzz@cpy.re>2021-10-29 11:48:21 +0200
commit2760b454a761f6af3138b2fb5f34340772ab0d1e (patch)
tree2b3a2d81478f8b432eb54cce4caa5a760c494627 /server/controllers/api/video-channel.ts
parente4611b54910d8e7f2b4f8a97ee2d9cc8e1054127 (diff)
downloadPeerTube-2760b454a761f6af3138b2fb5f34340772ab0d1e.tar.gz
PeerTube-2760b454a761f6af3138b2fb5f34340772ab0d1e.tar.zst
PeerTube-2760b454a761f6af3138b2fb5f34340772ab0d1e.zip
Deprecate filter video query
Introduce include and isLocal instead
Diffstat (limited to 'server/controllers/api/video-channel.ts')
-rw-r--r--server/controllers/api/video-channel.ts17
1 files changed, 13 insertions, 4 deletions
diff --git a/server/controllers/api/video-channel.ts b/server/controllers/api/video-channel.ts
index 7bf7a68c9..f9c1a405d 100644
--- a/server/controllers/api/video-channel.ts
+++ b/server/controllers/api/video-channel.ts
@@ -3,6 +3,7 @@ import { pickCommonVideoQuery } from '@server/helpers/query'
3import { Hooks } from '@server/lib/plugins/hooks' 3import { Hooks } from '@server/lib/plugins/hooks'
4import { ActorFollowModel } from '@server/models/actor/actor-follow' 4import { ActorFollowModel } from '@server/models/actor/actor-follow'
5import { getServerActor } from '@server/models/application/application' 5import { getServerActor } from '@server/models/application/application'
6import { guessAdditionalAttributesFromQuery } from '@server/models/video/formatter/video-format-utils'
6import { MChannelBannerAccountDefault } from '@server/types/models' 7import { MChannelBannerAccountDefault } from '@server/types/models'
7import { ActorImageType, VideoChannelCreate, VideoChannelUpdate } from '../../../shared' 8import { ActorImageType, VideoChannelCreate, VideoChannelUpdate } from '../../../shared'
8import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' 9import { HttpStatusCode } from '../../../shared/models/http/http-error-codes'
@@ -327,16 +328,24 @@ async function listVideoChannelPlaylists (req: express.Request, res: express.Res
327} 328}
328 329
329async function listVideoChannelVideos (req: express.Request, res: express.Response) { 330async function listVideoChannelVideos (req: express.Request, res: express.Response) {
331 const serverActor = await getServerActor()
332
330 const videoChannelInstance = res.locals.videoChannel 333 const videoChannelInstance = res.locals.videoChannel
331 const followerActorId = isUserAbleToSearchRemoteURI(res) ? null : undefined 334
335 const displayOnlyForFollower = isUserAbleToSearchRemoteURI(res)
336 ? null
337 : {
338 actorId: serverActor.id,
339 orLocalVideos: true
340 }
341
332 const countVideos = getCountVideos(req) 342 const countVideos = getCountVideos(req)
333 const query = pickCommonVideoQuery(req.query) 343 const query = pickCommonVideoQuery(req.query)
334 344
335 const apiOptions = await Hooks.wrapObject({ 345 const apiOptions = await Hooks.wrapObject({
336 ...query, 346 ...query,
337 347
338 followerActorId, 348 displayOnlyForFollower,
339 includeLocalVideos: true,
340 nsfw: buildNSFWFilter(res, query.nsfw), 349 nsfw: buildNSFWFilter(res, query.nsfw),
341 withFiles: false, 350 withFiles: false,
342 videoChannelId: videoChannelInstance.id, 351 videoChannelId: videoChannelInstance.id,
@@ -350,7 +359,7 @@ async function listVideoChannelVideos (req: express.Request, res: express.Respon
350 'filter:api.video-channels.videos.list.result' 359 'filter:api.video-channels.videos.list.result'
351 ) 360 )
352 361
353 return res.json(getFormattedObjects(resultList.data, resultList.total)) 362 return res.json(getFormattedObjects(resultList.data, resultList.total, guessAdditionalAttributesFromQuery(query)))
354} 363}
355 364
356async function listVideoChannelFollowers (req: express.Request, res: express.Response) { 365async function listVideoChannelFollowers (req: express.Request, res: express.Response) {