From 7338678a12f562ef1729fb1492d1f6bcd003c31d Mon Sep 17 00:00:00 2001 From: Rostislav Wolny Date: Mon, 16 Nov 2020 16:26:07 +0100 Subject: [PATCH] Reset no forms transient on form status update [MAILPOET-3300] --- lib/API/JSON/v1/Forms.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/API/JSON/v1/Forms.php b/lib/API/JSON/v1/Forms.php index 14133da45a..c8467b35d9 100644 --- a/lib/API/JSON/v1/Forms.php +++ b/lib/API/JSON/v1/Forms.php @@ -113,6 +113,10 @@ class Forms extends APIEndpoint { $form->setStatus($status); $this->formsRepository->flush(); + if ($status === FormEntity::STATUS_ENABLED) { + $this->wp->deleteTransient(DisplayFormInWPContent::NO_FORM_TRANSIENT_KEY); + } + $form = $this->formsRepository->findOneById($id); if (!$form instanceof FormEntity) return $this->errorResponse(); return $this->successResponse( @@ -200,7 +204,8 @@ class Forms extends APIEndpoint { } } - WPFunctions::get()->deleteTransient(DisplayFormInWPContent::NO_FORM_TRANSIENT_KEY); + // Reset no form cache + $this->wp->deleteTransient(DisplayFormInWPContent::NO_FORM_TRANSIENT_KEY); // check if the user gets to pick his own lists // or if it's selected by the admin