Skip to content

Commit

Permalink
FIX Use canDelete, not the now-deleted canArchive (#2984)
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli authored and emteknetnz committed Aug 19, 2024
1 parent 6120e89 commit 03efd3a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 1 addition & 3 deletions code/BatchActions/CMSBatchAction_Archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use SilverStripe\ORM\SS_List;
use SilverStripe\Admin\CMSBatchAction;
use SilverStripe\Control\HTTPResponse;
use SilverStripe\Dev\Deprecation;

/**
* Delete items batch action.
Expand All @@ -28,7 +27,6 @@ public function run(SS_List $pages): HTTPResponse

public function applicablePages($ids)
{
// canArchive() is deprecated, not $this->applicablePagesHelper()
return Deprecation::withNoReplacement(fn() => $this->applicablePagesHelper($ids, 'canArchive'));
return $this->applicablePagesHelper($ids, 'canDelete');
}
}
4 changes: 1 addition & 3 deletions code/Controllers/CMSMain.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
use SilverStripe\Core\Environment;
use SilverStripe\Core\Flushable;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Dev\Deprecation;
use SilverStripe\Forms\DateField;
use SilverStripe\Forms\DropdownField;
use SilverStripe\Forms\FieldGroup;
Expand Down Expand Up @@ -1998,8 +1997,7 @@ public function archive(array $data, Form $form): HTTPResponse
if (!$record || !$record->exists()) {
throw new HTTPResponse_Exception("Bad record ID #$id", 404);
}
$canArchive = Deprecation::withNoReplacement(fn() => $record->canArchive());
if (!$canArchive) {
if (!$record->canDelete()) {
return Security::permissionFailure();
}

Expand Down

0 comments on commit 03efd3a

Please sign in to comment.