Block updating workflows with active runs in the backend

[MAILPOET-4744]
This commit is contained in:
David Remer
2022-11-02 15:28:22 +02:00
committed by John Oleksowicz
parent c8cf00a151
commit 902eeccea1
2 changed files with 46 additions and 0 deletions

View File

@ -32,6 +32,7 @@ class Exceptions {
private const MISSING_REQUIRED_SUBJECTS = 'mailpoet_automation_missing_required_subjects';
private const WORKFLOW_NOT_TRASHED = 'mailpoet_automation_workflow_not_trashed';
private const WORKFLOW_TEMPLATE_NOT_FOUND = 'mailpoet_automation_workflow_template_not_found';
private const WORKFLOW_HAS_ACTIVE_RUNS = 'mailpoet_automation_workflow_has_active_runs';
public function __construct() {
throw new InvalidStateException(
@ -228,4 +229,14 @@ class Exceptions {
// translators: %d is the ID of the automation template.
->withMessage(sprintf(__("Automation template with ID '%d' not found.", 'mailpoet'), $id));
}
/**
* This is a temporary block, see MAILPOET-4744
*/
public static function workflowHasActiveRuns(int $id): InvalidStateException {
return InvalidStateException::create()
->withErrorCode(self::WORKFLOW_HAS_ACTIVE_RUNS)
// translators: %d is the ID of the workflow.
->withMessage(sprintf(__("Can not update workflow with ID '%d' because users are currently active.", 'mailpoet'), $id));
}
}