From cf4a6a8d0dd021a8f4b5e25ad4581736e7d11297 Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Wed, 14 Aug 2024 10:32:50 +1200 Subject: [PATCH] FIX Use canDelete, not the now-deleted canArchive --- code/Controller/AssetAdmin.php | 2 +- code/GraphQL/Resolvers/AssetAdminResolver.php | 2 +- tests/php/Controller/AssetAdminTest/FileExtension.php | 8 -------- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/code/Controller/AssetAdmin.php b/code/Controller/AssetAdmin.php index 14d6542ed..5be50322f 100644 --- a/code/Controller/AssetAdmin.php +++ b/code/Controller/AssetAdmin.php @@ -1081,7 +1081,7 @@ public function getObjectFromData(File $file, $thumbnailLinks = true) $object['filename'] = $file->Filename; $object['url'] = $file->AbsoluteURL; $object['canEdit'] = $file->canEdit(); - $object['canDelete'] = ($file->hasMethod('canArchive')) ? $file->canArchive() : $file->canDelete(); + $object['canDelete'] = $file->canDelete(); $owner = $file->Owner(); diff --git a/code/GraphQL/Resolvers/AssetAdminResolver.php b/code/GraphQL/Resolvers/AssetAdminResolver.php index 642552fbb..06410f908 100644 --- a/code/GraphQL/Resolvers/AssetAdminResolver.php +++ b/code/GraphQL/Resolvers/AssetAdminResolver.php @@ -126,7 +126,7 @@ public static function resolveDeleteFiles($object, array $args, $context, Resolv $deletedIDs = []; $member = UserContextProvider::get($context); foreach ($files as $file) { - if ($file->canArchive($member)) { + if ($file->canDelete($member)) { $file->doArchive(); $deletedIDs[] = $file->ID; } diff --git a/tests/php/Controller/AssetAdminTest/FileExtension.php b/tests/php/Controller/AssetAdminTest/FileExtension.php index ae55b11b8..8727d54d0 100644 --- a/tests/php/Controller/AssetAdminTest/FileExtension.php +++ b/tests/php/Controller/AssetAdminTest/FileExtension.php @@ -28,14 +28,6 @@ public function canDelete($member = null) } } - public function canArchive($member = null) - { - if ($this->owner->Name === 'disallowCanDelete.txt') { - return false; - } - return $this->owner->canDelete($member); - } - public function canCreate($member = null, $context = []) {