From c76fdba2b7f0c3a1ece58d702c631f5552eb6073 Mon Sep 17 00:00:00 2001 From: Guy Sartorelli <36352093+GuySartorelli@users.noreply.github.com> Date: Thu, 15 Aug 2024 14:56:19 +1200 Subject: [PATCH] ENH Don't emit deprecation warnings for unavoidable API calls (#319) --- 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();