fix: torrent search playlist filter

We need to filter the given columns on the `playlists` table, not the `playlist_torrent` table.
This commit is contained in:
Roardom
2024-07-02 21:42:49 +00:00
parent 8723e234f5
commit fdf272122c
+4 -2
View File
@@ -240,10 +240,12 @@ trait TorrentFilter
->where('playlist_id', '=', $playlistId)
->when(
$authenticatedUser === null,
fn ($query) => $query->where('is_private', '=', false),
fn ($query) => $query->whereRelation('playlist', 'is_private', '=', false),
fn ($query) => $query->when(
! $authenticatedUser->group->is_modo,
fn ($query) => $query->where(fn ($query) => $query->where('is_private', '=', false)->orWhere('user_id', '=', $authenticatedUser->id))
fn ($query) => $query->where(fn ($query) => $query
->whereRelation('playlist', 'is_private', '=', false)
->orWhereRelation('playlist', 'user_id', '=', $authenticatedUser->id))
)
)
);