diff --git a/app/Http/Controllers/GalleryController.php b/app/Http/Controllers/GalleryController.php index fcace01dc5..7fb490d943 100644 --- a/app/Http/Controllers/GalleryController.php +++ b/app/Http/Controllers/GalleryController.php @@ -99,7 +99,7 @@ public function getGallery($id, Request $request) { return view('galleries.gallery', [ 'gallery' => $gallery, 'submissions' => $query->paginate(20)->appends($request->query()), - 'prompts' => [0 => 'Any Prompt'] + Prompt::whereIn('id', GallerySubmission::where('gallery_id', $gallery->id)->visible(Auth::check() ? Auth::user() : null)->accepted()->whereNotNull('prompt_id')->pluck('prompt_id')->toArray())->orderBy('name')->pluck('name', 'id')->toArray(), + 'prompts' => [0 => 'Any Prompt'] + Prompt::whereIn('id', GallerySubmission::where('gallery_id', $gallery->id)->visible(Auth::check() ? Auth::user() : null)->accepted()->whereNotNull('prompt_id')->select('prompt_id')->distinct()->pluck('prompt_id')->toArray())->orderBy('name')->pluck('name', 'id')->toArray(), 'childSubmissions' => GallerySubmission::whereIn('gallery_id', $gallery->children->pluck('id')->toArray())->where('is_visible', 1)->where('status', 'Accepted'), 'galleryPage' => true, 'sideGallery' => $gallery, diff --git a/resources/views/galleries/gallery.blade.php b/resources/views/galleries/gallery.blade.php index 0df2319563..fbbc612679 100644 --- a/resources/views/galleries/gallery.blade.php +++ b/resources/views/galleries/gallery.blade.php @@ -26,7 +26,7 @@

@endif

{!! $gallery->description !!}

- @if (!$gallery->submissions->count() && $gallery->children->count() && $childSubmissions->count()) + @if (!$gallery->submissions()->count() && $gallery->children->count() && $childSubmissions->count())

This gallery has no submissions; instead, displayed is a selection of the most recent submissions from its sub-galleries. Please navigate to one of the sub-galleries to view more.

@endif @@ -59,7 +59,7 @@ {!! Form::close() !!} - @if ($gallery->submissions->count()) + @if ($gallery->submissions()->count()) {!! $submissions->render() !!}