Skip to content

Commit 42ffa04

Browse files
authored
Merge pull request #4655 from Roardom/fix-similar-playlist-query
(Fix) Similar page playlists query
2 parents 4a20a82 + 1d270ab commit 42ffa04

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Diff for: app/Http/Livewire/SimilarTorrent.php

+10
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,16 @@ final public function torrentRequests(): \Illuminate\Database\Eloquent\Collectio
409409
final public function playlists(): \Illuminate\Database\Eloquent\Collection
410410
{
411411
return Playlist::query()
412+
->withCount('torrents')
413+
->when(
414+
! auth()->user()->group->is_modo,
415+
fn ($query) => $query
416+
->where(
417+
fn ($query) => $query
418+
->where('is_private', '=', 0)
419+
->orWhere(fn ($query) => $query->where('is_private', '=', 1)->where('user_id', '=', auth()->id()))
420+
)
421+
)
412422
->when($this->category->movie_meta, fn ($query) => $query->whereRelation('torrents', 'tmdb_movie_id', '=', $this->tmdbId))
413423
->when($this->category->tv_meta, fn ($query) => $query->whereRelation('torrents', 'tmdb_tv_id', '=', $this->tmdbId))
414424
->when($this->category->game_meta, fn ($query) => $query->whereRelation('torrents', 'igdb_game_id', '=', $this->tmdbId))

0 commit comments

Comments
 (0)