Saving a draft without making changes resets the workflow with `WAGTAIL_WORKFLOW_REQUIRE_REAPPROVAL_ON_EDIT = True`
Issue Summary
When WAGTAIL_WORKFLOW_REQUIRE_REAPPROVAL_ON_EDIT = True, if one saves a draft without making any changes, then approves, the workflow resets back to the first step
Steps to Reproduce
- Create a workflow with three steps (two is also fine), and assign to a relevant part of the tree.
- Create a page and submit for moderation.
- Approve to the last step, or at least one step.
- Click "Save draft" without making any changes.
- Click "Approve"
- The workflow goes to the first step. Expected: the page publishes, or moves to the next step.
The logic for WAGTAIL_WORKFLOW_REQUIRE_REAPPROVAL_ON_EDIT = True kicks in if there is a new revision saved. However, if you do not make any changes, we should not really have a new revision -- from a user perspective, nothing has changes, so the workflow should not reset.
Technical details
- Wagtail version: latest main
Working on this
Anyone can contribute to this. View our contributing guidelines, add a comment to the issue once you’re ready to start.
However, if you do not make any changes, we should not really have a new revision
That sounds more like a different thing that's not necessarily related to workflows, and would be a change in behaviour that could be unexpected. Does that have to be done in order to achieve the main goal, i.e. to not require reapproval when new drafts are saved without any changes?
hey @zerolab can i work on this issue ?
Thanks for your interest! We don't assign issues outside the core team. Please give our first contribution guide a read. The short version - always check the issue carefully, especially for any signs of an existing PR. If there's nothing, and no one else mentioned they are working on it, say you’re taking on the issue in a comment and go for it. In this case, first step is to reproduce the issue.
@zerolab i like to work on this i think When WAGTAIL_WORKFLOW_REQUIRE_REAPPROVAL_ON_EDIT=True, only task states linked to the latest revision count as "successful". Since a new revision was created when clicking "Save draft", the previously approved task states are now linked to an old revision, so they no longer count as successful. The workflow thus resets to the first task.