Reset no forms transient on form status update

[MAILPOET-3300]
This commit is contained in:
Rostislav Wolny
2020-11-16 16:26:07 +01:00
committed by Veljko V
parent 79fb1122ec
commit 7338678a12

View File

@ -113,6 +113,10 @@ class Forms extends APIEndpoint {
$form->setStatus($status); $form->setStatus($status);
$this->formsRepository->flush(); $this->formsRepository->flush();
if ($status === FormEntity::STATUS_ENABLED) {
$this->wp->deleteTransient(DisplayFormInWPContent::NO_FORM_TRANSIENT_KEY);
}
$form = $this->formsRepository->findOneById($id); $form = $this->formsRepository->findOneById($id);
if (!$form instanceof FormEntity) return $this->errorResponse(); if (!$form instanceof FormEntity) return $this->errorResponse();
return $this->successResponse( 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 // check if the user gets to pick his own lists
// or if it's selected by the admin // or if it's selected by the admin