1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 10:19:35 +02:00

Optimize list my playlists SQL query

This commit is contained in:
Chocobozzz 2020-01-09 09:26:59 +01:00
parent 119b16e5ac
commit 6b0c3c7ca9
No known key found for this signature in database
GPG key ID: 583A612D890159BE
3 changed files with 36 additions and 23 deletions

View file

@ -133,9 +133,9 @@ async function listAccountPlaylists (req: express.Request, res: express.Response
const serverActor = await getServerActor()
// Allow users to see their private/unlisted video playlists
let privateAndUnlisted = false
let listMyPlaylists = false
if (res.locals.oauth && res.locals.oauth.token.User.Account.id === res.locals.account.id) {
privateAndUnlisted = true
listMyPlaylists = true
}
const resultList = await VideoPlaylistModel.listForApi({
@ -145,7 +145,7 @@ async function listAccountPlaylists (req: express.Request, res: express.Response
count: req.query.count,
sort: req.query.sort,
accountId: res.locals.account.id,
privateAndUnlisted,
listMyPlaylists,
type: req.query.playlistType
})