1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-03 09:49:20 +02:00

Add ability to order playlists

This commit is contained in:
Chocobozzz 2025-06-19 15:56:06 +02:00
parent 546bd42240
commit 0adafa0fc0
No known key found for this signature in database
GPG key ID: 583A612D890159BE
48 changed files with 1776 additions and 607 deletions

View file

@ -1,3 +1,4 @@
import { VideoPlaylistsListQuery } from '@peertube/peertube-models'
import { pickCommonVideoQuery } from '@server/helpers/query.js'
import { ActorFollowModel } from '@server/models/actor/actor-follow.js'
import { getServerActor } from '@server/models/application/application.js'
@ -182,6 +183,7 @@ async function listAccountChannelsSync (req: express.Request, res: express.Respo
async function listAccountPlaylists (req: express.Request, res: express.Response) {
const serverActor = await getServerActor()
const query = req.query as VideoPlaylistsListQuery
// Allow users to see their private/unlisted video playlists
let listMyPlaylists = false
@ -190,18 +192,19 @@ async function listAccountPlaylists (req: express.Request, res: express.Response
}
const resultList = await VideoPlaylistModel.listForApi({
search: req.query.search,
followerActorId: isUserAbleToSearchRemoteURI(res)
? null
: serverActor.id,
start: req.query.start,
count: req.query.count,
sort: req.query.sort,
accountId: res.locals.account.id,
listMyPlaylists,
type: req.query.playlistType
start: query.start,
count: query.count,
sort: query.sort,
search: query.search,
type: query.playlistType
})
return res.json(getFormattedObjects(resultList.data, resultList.total))