Skip to content

Commit

Permalink
Revert "simplify"
Browse files Browse the repository at this point in the history
This reverts commit fd99cb1.
  • Loading branch information
duncanmcclean committed May 30, 2024
1 parent fd99cb1 commit e246b27
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
6 changes: 1 addition & 5 deletions src/Http/Controllers/API/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions src/Http/Controllers/API/CollectionEntriesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e246b27

Please sign in to comment.