0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-21 18:09:02 +01:00

Check workflow cancel before getting workflow

This commit is contained in:
Jake Howard 2024-10-04 10:49:55 +01:00 committed by Matt Westcott
parent b0c90d4be2
commit 37567dfe18

View File

@ -94,9 +94,8 @@ class PublishRevisionAction:
)
if isinstance(self.object, WorkflowMixin):
workflow_state = self.object.current_workflow_state
if workflow_state and getattr(
settings, "WAGTAIL_WORKFLOW_CANCEL_ON_PUBLISH", True
if getattr(settings, "WAGTAIL_WORKFLOW_CANCEL_ON_PUBLISH", True) and (
workflow_state := self.object.current_workflow_state
):
workflow_state.cancel(user=self.user)