This is a followup ticket from #3026024: Moderation state missing on locked entities, as it seems the ticket purpose has changed in the meantime.
Problem/Motivation
When the content is locked by user A, user B can still change the moderation state and potentialy publish a draft which is being locked.
The moderation state cannot be changed on the entity edit form, this works as expected, but when using the content moderation form, you can still change the status.
Steps to reproduce
Given: a node that has a published version and a draft version.
- Open the node edit form with user 1
- In a separate (incognito) window open the nodes draft page with user 2 (/node/123/latest)
- With user 2, change the moderation state to "Published"
- Save the node with user 1
Step #3 should not be possible.
Step #4 will show a "The content has either been modified by another user, or you have already submitted modifications. As a result, your changes cannot be saved." error message.
Proposed resolution
Disable the content moderation form when the content is locked by another user.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | content_lock-3554181-content_moderation_form-4.patch | 1.66 KB | ludo.r |
Issue fork content_lock-3554181
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
ludo.rComment #4
ludo.rAnd here's the patch for those who don't trust volatile Merge Requests.
Comment #5
ludo.rComment #6
ludo.rComment #9
alexpottThe work for 3.x is slightly different from the 2.x version - it does not lock the content when you visit the entity view. That seems a bit over zealous - it completely removes the form by setting access to false.
Comment #10
alexpottComment #12
alexpott