From e246b27ef62d37b70b8dafd2ba8ad0e2d3ee3e2a Mon Sep 17 00:00:00 2001 From: Duncan McClean Date: Thu, 30 May 2024 11:09:51 +0100 Subject: [PATCH] Revert "simplify" This reverts commit fd99cb11531d965ca9c3f4a31f18fb12fc3bc6af. --- src/Http/Controllers/API/ApiController.php | 6 +----- src/Http/Controllers/API/CollectionEntriesController.php | 1 + 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Http/Controllers/API/ApiController.php b/src/Http/Controllers/API/ApiController.php index 54d5cdb96b..7a80d4c4ce 100644 --- a/src/Http/Controllers/API/ApiController.php +++ b/src/Http/Controllers/API/ApiController.php @@ -2,7 +2,6 @@ namespace Statamic\Http\Controllers\API; -use Facades\Statamic\API\FilterAuthorizer; use Facades\Statamic\API\ResourceAuthorizer; use Illuminate\Http\Request; use Statamic\Exceptions\ApiValidationException; @@ -31,10 +30,7 @@ protected function abortIfUnpublished(Request $request, $item) return; } - if ( - $request->boolean('draft') - && in_array('status', FilterAuthorizer::allowedForSubResources('api', 'collections', $item->collectionHandle())) - ) { + if (in_array('status', $this->allowedFilters()) && $request->boolean('draft')) { return; } diff --git a/src/Http/Controllers/API/CollectionEntriesController.php b/src/Http/Controllers/API/CollectionEntriesController.php index 3ebd339d7f..baaa1143f2 100644 --- a/src/Http/Controllers/API/CollectionEntriesController.php +++ b/src/Http/Controllers/API/CollectionEntriesController.php @@ -39,6 +39,7 @@ public function show(Request $request, $collection, $handle) $this->abortIfDisabled(); $entry = Entry::find($handle); + $this->collectionHandle = $entry?->collectionHandle(); $this->abortIfInvalid($entry, $collection); $this->abortIfUnpublished($request, $entry);