Skip to content

Commit

Permalink
FIX Use canDelete, not the now-deleted canArchive
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Aug 13, 2024
1 parent 63fd617 commit 42aee9d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion code/BatchActions/CMSBatchAction_Archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ public function run(SS_List $pages): HTTPResponse

public function applicablePages($ids)
{
return $this->applicablePagesHelper($ids, 'canArchive');
return $this->applicablePagesHelper($ids, 'canDelete');
}
}
6 changes: 3 additions & 3 deletions code/Controllers/CMSMain.php
Original file line number Diff line number Diff line change
Expand Up @@ -1109,13 +1109,13 @@ private function buildListViewBreadcrumb(ArrayList $items, SiteTree $page): void
// Find all ancestors of the provided page
$ancestors = $page->getAncestors(true);
$ancestors = array_reverse($ancestors->toArray() ?? []);

//turns the title and link of the breadcrumbs into template-friendly variables
$params = array_filter([
'view' => $this->getRequest()->getVar('view'),
'q' => $this->getRequest()->getVar('q')
]);

foreach ($ancestors as $ancestor) {
// Link back to the list view for the current ancestor
$params['ParentID'] = $ancestor->ID;
Expand Down Expand Up @@ -1997,7 +1997,7 @@ public function archive(array $data, Form $form): HTTPResponse
if (!$record || !$record->exists()) {
throw new HTTPResponse_Exception("Bad record ID #$id", 404);
}
if (!$record->canArchive()) {
if (!$record->canDelete()) {
return Security::permissionFailure();
}

Expand Down
2 changes: 1 addition & 1 deletion code/Model/SiteTree.php
Original file line number Diff line number Diff line change
Expand Up @@ -2585,7 +2585,7 @@ public function getCMSActions()
}

// If a page is on any stage it can be archived
if (($isOnDraft || $isPublished) && $this->canArchive()) {
if (($isOnDraft || $isPublished) && $this->canDelete()) {
$title = $isPublished
? _t('SilverStripe\\CMS\\Controllers\\CMSMain.UNPUBLISH_AND_ARCHIVE', 'Unpublish and archive')
: _t('SilverStripe\\CMS\\Controllers\\CMSMain.ARCHIVE', 'Archive');
Expand Down

0 comments on commit 42aee9d

Please sign in to comment.