From 8ebcd20bf3fd7385d6d3a8cc3bc62c3a6fea29c4 Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Wed, 14 Aug 2024 11:33:36 +1200 Subject: [PATCH] ENH Don't emit deprecation warnings for unavoidable API calls --- src/Controllers/LinkFieldController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Controllers/LinkFieldController.php b/src/Controllers/LinkFieldController.php index 2e5bb2bc..840d5c25 100644 --- a/src/Controllers/LinkFieldController.php +++ b/src/Controllers/LinkFieldController.php @@ -16,6 +16,7 @@ use SilverStripe\Control\Controller; use SilverStripe\Control\HTTPRequest; use SilverStripe\Core\Injector\Injector; +use SilverStripe\Dev\Deprecation; use SilverStripe\Forms\HiddenField; use SilverStripe\LinkField\Services\LinkTypeService; use SilverStripe\ORM\DataList; @@ -133,7 +134,8 @@ public function linkDelete(): HTTPResponse } $link = $this->linkFromRequest(); if ($link->hasExtension(Versioned::class)) { - if (!$link->canArchive()) { + $canArchive = Deprecation::withNoReplacement(fn() => $link->canArchive()); + if (!$canArchive) { $this->jsonError(403); } $link->doArchive();