From ec3356e7cc1585840489f2f8ed62270fedc93fbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Randy=20=C4=8Cupi=C4=87?= Date: Tue, 24 Oct 2023 21:47:24 +0200 Subject: [PATCH] Revert "Don't update resource on webhook notifications if not needed" This reverts commit a090559d74effd9a61e7849d381cd57c3d3ede1c. --- .../Controller/Callback/Cloudinary/Notify.php | 21 +++---------------- 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/bundle/Controller/Callback/Cloudinary/Notify.php b/bundle/Controller/Callback/Cloudinary/Notify.php index 6e4d6dca..1fee4e85 100644 --- a/bundle/Controller/Callback/Cloudinary/Notify.php +++ b/bundle/Controller/Callback/Cloudinary/Notify.php @@ -257,26 +257,19 @@ private function handleTagsChanged(array $requestContent): void continue; } - $changed = false; - foreach ($resourceData['added'] ?? [] as $tag) { $resource->addTag($tag); - $changed = true; } foreach ($resourceData['removed'] ?? [] as $tag) { $resource->removeTag($tag); - $changed = true; } foreach ($resourceData['updated'] ?? [] as $tag) { $resource->addTag($tag); - $changed = true; } - if ($changed === true) { - $this->provider->store($resource); - } + $this->provider->store($resource); } } @@ -312,10 +305,7 @@ private function handleContextChanged(array $requestContent): void continue; } - $changed = false; - foreach ($resourceData['added'] ?? [] as $value) { - $changed = true; switch ($value['name']) { case 'alt': $resource->setAltText($value['value']); @@ -335,7 +325,6 @@ private function handleContextChanged(array $requestContent): void } foreach ($resourceData['removed'] ?? [] as $value) { - $changed = true; switch ($value['name']) { case 'alt': $resource->setAltText(null); @@ -355,15 +344,13 @@ private function handleContextChanged(array $requestContent): void } foreach ($resourceData['updated'] ?? [] as $value) { - $changed = true; switch ($value['name']) { case 'alt': $resource->setAltText($value['value']); break; case 'caption': - $resource->setCaption($value['value']) - $changed = true; + $resource->setCaption($value['value']); break; case 'original_filename': @@ -375,9 +362,7 @@ private function handleContextChanged(array $requestContent): void } } - if ($changed === true) { - $this->provider->store($resource); - } + $this->provider->store($resource); } }