Problem/Motivation
Discovered by @xjm in #2862041-175: Provide useful Views filters for Content Moderation State fields. Quoting the steps to reproduce:
- Add Editorial to articles.
- Edit the frontpage view. Add a moderation state filter. You'll see Draft, Published, Archive as allowed values. Select Archive and save. (Let's say archive is a published state.).
- Add a new workflow called Albatross with "Bird" and "Mariner" states. Attach it to pages.
- Edit the frontpage view. Edit the moderation state filter. You'll see Draft, Published, Archive, Bird, Mariner as allowed values.
- Remove the Editorial workflow from articles. Back to the view. Your only options are Bird and Mariner. Until you actually save this filter, though, your view still has Archive stored in the config. When you save it, though, it's impossible to save Archive to the config anymore.
Proposed resolution
Disallow removing moderation for a bundle that has moderated content.
Remaining tasks
- code this in \Drupal\content_moderation\EventSubscriber\ConfigImportSubscriber too
- add tests
User interface changes
Yes, a bundle that has moderated content can not be removed from a workflow.
API changes
Same as the UI changes but on config sync.
Data model changes
Nope.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 2907449.patch | 7.82 KB | amateescu |
Comments
Comment #2
amateescu commentedThis fixes the problem on the UI side.
Comment #3
sam152 commentedAre we confident there are other more fundamental issues with disabling moderation on a bundle that has already been moderated? I don't think the views issue is compelling enough by itself (although I'm yet to get in there and do some proper testing), so if we can justify the extra complexity with a scarier scenario, I think that might help.
NW, because for the other integrity related methods, we also enforce this during config validation. Also likely to heavily conflict with #2897148: Remove @internal from workflowHasData/workflowStateHasData and use those methods for access control and configuration validation..
Comment #4
amateescu commentedNot sure about other fundamental issues, I'll get back to this question tomorrow.
Yep, that's already mentioned in the issue summary :)
Why does it conflict with that patch, we're just adding a new method to
\Drupal\content_moderation\Plugin\WorkflowType\ContentModerationInterfacehere.Comment #5
sam152 commentedMy mistake! So it is. It will conflict because we're essentially making the config import validation stuff part of the actual
@WorklfowTypeplugin API, so we'll need to move the subscriber.Comment #8
sam152 commentedIf I can summarise a year old conversation, disabling moderation on a bundle with moderated content results in a views usability WTF, but not much else.
If this is the only issue, I think we should close this because not allowing the user to disable moderation is a usability WTF in itself and this feels like the kind of change which could regularly cause grief to users, whereas the views issue is pretty innocuous.