From 85e00228272cb34256304999a516639f5b36f90c Mon Sep 17 00:00:00 2001 From: bencroker Date: Mon, 1 Apr 2024 09:44:44 -0600 Subject: [PATCH] Fix redirect and return --- CHANGELOG.md | 1 + src/elements/SendoutElement.php | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b6cd91c..5e0c7f45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Fixed - Fixed the buttons to create new campaign types and mailing list types appearing when allow admin changes was disabled or the user did not have the necessary permissions. +- Fixed an error that could appear when clicking on a sent sendout as an impersonated user in Craft Cloud. ## 2.13.1 - 2024-03-26 diff --git a/src/elements/SendoutElement.php b/src/elements/SendoutElement.php index d78fb7be..565d0100 100755 --- a/src/elements/SendoutElement.php +++ b/src/elements/SendoutElement.php @@ -578,7 +578,8 @@ public function prepareEditScreen(Response $response, string $containerId): void // Only redirect if we're not already redirecting, to prevent an endless loop in Craft 4.0.4 and above. // https://github.com/putyourlightson/craft-campaign/issues/316 if (!$response->getIsRedirection()) { - $response->redirect($this->getCpPreviewUrl()); + $response->redirect($this->getCpPreviewUrl())->send(); + return; } }