Skip to content

Conversation

@zerolab
Copy link
Contributor

@zerolab zerolab commented Jan 14, 2026

What is the context of this PR?

This PR updates the page locking rules:

  1. a Publishing Admin can unlock another user's manual page lock, when the page is in review
  2. a Publishing Officer can lock/unlock their own lock, when the page is in review
  3. when a page hits the "Ready to publish" step, editing is locked
    • can be unlocked if the page is not in a bundle, or in a bundle that is not in review. Unlocking moves the page back to "In review"
    • cannot be unlock if the page is in a bundle that is ready to be in review

Screencast

How to review

  1. as PO
    • create a simple page, send for review
    • lock / unlock from the info page
    • re-lock
  2. as PA
    • go to edit the page, see that you can unlock.
    • Unlock, then lock it
  3. as PO - check that you cannot unlock the PA lock
  4. Approve to send to "Ready to publish"
    • editing is locked
    • but the action menu has an option to "unlock"
    • "Unlock editing" ->
  5. Add the page in a bundle
    • check page is locked when in Ready to publish, but can be unlocked while the bundle is not Ready to publish

Follow-up Actions

List any follow-up actions (if applicable), like needed documentation updates or additional testing.

tl;dr -
Wagtail now provides a better panel API - https://docs.wagtail.org/en/latest/extending/client_side_panels.html
via wagtail/wagtail#13248 and follow ups.

This means that InlinePanel/MultipleChooserPanel now respects the
read-only attribute, so we don't need a whole separate template
Annotations are now lazy by default, so the quoting can be removed.
https://docs.python.org/3/whatsnew/3.14.html#whatsnew314-deferred-annotations

However, if third-party depends on `.__annotations__` then you need
`from __future__ import annotations` -- needed for instance of code that
import Django Views
The `aria_label_format` attribute was removed
ref: wagtail/wagtail@8c18b13
Copy link
Contributor

@MebinAbraham MebinAbraham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done and initial pass, mostly all seems as expected. 👍

Will re-review once we have a direction on #462 (comment)


class PageInBundleReadyToBePublishedLock(BaseLock):
"""A lock that is enabled when the page is in a bundle that is ready to be published."""
class PageReadyToBePublishedLock(WorkflowLock):
Copy link
Contributor

@MebinAbraham MebinAbraham Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, there is a scenario where the locking mechanism can be bypassed, allowing content to be edited when it should not be.

If a page is locked by the workflow, a Publishing Admin cannot edit it through the normal edit view, as expected. However, the PA can still apply a manual user lock to the same page. While that user lock is active, they are able to make edits. When they then remove their own lock, those changes persist, even though the page remains locked by the workflow and is still in the Ready to publish state. The UI continues to indicate that the page is locked by the workflow and cannot be edited, but the content has already been modified.

This effectively bypasses the workflow lock, as content changes are saved without the page leaving the Ready to publish state.

We should disallow user-level locking for all users when a page is already locked by the workflow. Editors must unlock or cancel the workflow before they can apply a user lock and make changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MebinAbraham can you share the step to reproduce this? I feel like I am missing something

Copy link
Contributor

@MebinAbraham MebinAbraham Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My mistake, just had another look and I think we are actually okay, it seems like I was testing with a super user, so the scenario is only an issue with a super user account. As a Publishing Admin I can see that the page is locked when workflow locks it. Just for super admin, the page is not locked even if it is locked by workflow..

So when page is locked by workflow, PA sees:
image

But super admin sees:
image

It would be nice for the super admin to have the same behaviour (SA should be able to bypass workflow i.e. local dev but not work around it), but happy as-is, given that the elevated role doesn't exist in live.

Copy link
Contributor Author

@zerolab zerolab Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is hard to do without monkey_patching because of https://github.com/wagtail/wagtail/blob/f7407b5319f3ff3935632ee7ca7e6d59918b8e94/wagtail/admin/views/generic/mixins.py#L334-L339 I take it back. PagePermissionTester.can_lock ftw

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to be mostly there but now after unlocking it, for superusers, it still says locked by workflow even though it is unlocked. Works fine for PA/PO.
image

@zerolab zerolab mentioned this pull request Jan 22, 2026
1 task
Copy link
Contributor

@MebinAbraham MebinAbraham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

It would be great if some of this was added back to core. I have some concerns about the divergence and it would be good to stay aligned with core as much as possible, especially when it comes to some core capabilities like workflows/publish.

And the "This page is included in a bundle that is ready to be published. You must revert the bundle to Draft or In preview in order to make further changes." text is displayed


Scenario: When page is Approved (Ready to publish) and not in a bundle, a Publishing Admin can publish it
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: We should also validate the inverse, i.e. prove that when in a bundle, they can't publish it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


class PageInBundleReadyToBePublishedLock(BaseLock):
"""A lock that is enabled when the page is in a bundle that is ready to be published."""
class PageReadyToBePublishedLock(WorkflowLock):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to be mostly there but now after unlocking it, for superusers, it still says locked by workflow even though it is unlocked. Works fine for PA/PO.
image

@sanjeevz3009 sanjeevz3009 self-requested a review January 27, 2026 16:37
@sanjeevz3009
Copy link
Contributor

@zerolab Due to the higher priority of help/ info pages work and other priorities. Will come back to this, Dan and the other PR branched of this.

@MebinAbraham
Copy link
Contributor

Need to validate some odd behaviour I have seen, will double check and report back.

@MebinAbraham
Copy link
Contributor

Need to validate some odd behaviour I have seen, will double check and report back.

False alarm, user error 🙈

@zerolab
Copy link
Contributor Author

zerolab commented Jan 30, 2026

@MebinAbraham I've addressed #462 (comment) in ac3dbf1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: Workflows All things related to editorial workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants