Problem/Motivation
When using this module in conjunction with content_moderation and content_translation it is possible to have draft content become published after running a bulk update.
Steps to reproduce
Typically we use the DrupalWxt distribution which includes these configs, if configuring by hand you will need to:
- Install content_moderation and create a workflow with minimally draft and published;
- Install content_translation and add a second language (Fr);
- Create a content type and set it for both moderation and translation;
- Create a node in En and publish it;
- Translate the node in Fr and publish it;
- Edit the French node and add 'DRAFT' to the title and save as Draft;
- In admin/content use VBO to bulk modify field values and add test to both the En and Fr node bodies.
The result of this test is that the Fr draft content will be published with the log message: Edited as a part of bulk operation. Field changed: body (Published)
Proposed resolution
I believe this defect is as a result of #3080995: EntityRepository::getActive does not return a translations most recent revision which does not look like it is being fixed anytime soon. However, the patch from this issue: #2797583: Dynamically provide action plugins for every moderation state change provides a method for getting the latest revision. Also, for content moderated nodes this issue #3285038: Revision checkbox may not be selectable for moderated content is relevant as creating a new revision is required for moderated content, however, I think the patch itself may need some work as it should likely check each entity to see if it is moderated and if it is ensure a new revision is created.
Remaining tasks
Automated tests.
User interface changes
None.
API changes
None.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | views_bulk_edit-incorrect_revision-3559935-2.patch | 3.03 KB | joel_osc |
Comments
Comment #2
joel_osc commentedHere is a patch that uses the getLatestRevision method from #2797583: Dynamically provide action plugins for every moderation state change instead EntityRepository::getActive.
Comment #3
joel_osc commentedThe uploaded patch is close as it works in some cases but not for the steps stated above, changing issue to needs work. The case it does work for which is where I need it is changing a non-translatable taxonomy entity reference field. Dealing with revisioning in a moderated, translated Drupal instance is really mind-bending.