Problem/Motivation
When disabling moderation on a bundle all ContentModerationState entities are left intact.
Proposed resolution
Give the user the option to remove all ContentModerationState entities for the given bundle (or not).
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #29 | interdiff_25-29.txt | 963 bytes | ravi.shankar |
| #29 | 2817845-29.patch | 3.63 KB | ravi.shankar |
| #25 | reroll_diff_2817845_24_2817845_25.txt | 1.23 KB | yogeshmpawar |
| #25 | 2817845-25.patch | 3.64 KB | yogeshmpawar |
| #24 | reroll_diff_2-24.txt | 3.91 KB | ravi.shankar |
Comments
Comment #2
cilefen commentedComment #3
sam152 commentedButton that only appears after moderation is enabled and the user tries to disable it.
Here is an early patch. Since we don't have a concrete entity reference field to the associated entity we can't write queries that include the bundle. There was some unholy approach I could see that involved a hook query alter, but the easiest approach seemed to be to store the bundle as well.
Before going any further and writing tests and an upgrade path we should probably discuss/agree on:
Comment #4
timmillwoodComment #5
Bojhan commentedThis is not reviewable. Can this get a less technical explanation?
Most of what I see in the screenshot would be a HIG violation, so I would recommend to start with identifying the different ways this could be solved, rather than already converging to the one solution.
Comment #6
timmillwood@Bojhan - When creating or updating a moderated entity we create a ContentModerationState entity to store the moderation state for the content. If the site builder disables moderation these ContentModerationState entities don't get deleted, they are just left in the database. From a UX point of view, what should we be doing with this data?
IMHO as @Sam152's patch shows I think we should have the option to delete this data, but I think wording is important, because this is hidden (meta like) data.
Also the "Delete" link shown in the screenshot shouldn't be there, #2818267: Remove delete link from Manage moderation settings page is working to resolve this.
Maybe the grey button shown in the screenshot should be a red link? Because it's a destructive action. Then does it need a confirmation form?
Comment #7
sam152 commentedMost of what I see in the screenshot would be a HIG violationFor those of us who don't know much about this, can you elaborate on what aspects are wrong? I think the convergence is based on there being a limited number of places or options this feature could slot in.
I think useful feedback would be:
I like the idea to make the button red.
Comment #8
Bojhan commentedComment #9
Daniel Kanchev commentedHi everyone :) I read the description of the problem and all the comments and I would like to ask the following questions:
1. @Bojhan is there an existing Human Interface guidelines Drupal document which I can find somewhere and read it? If there is such a document is everything in it obligatory or is the information in it just supposed to guide people?
2. @timmillwood and @Sam152 - in your case you wanted to delete all ContentModerationState entities for the given bundle and that is why you added the button in question. However, is this the only action which should be offered to the user? In other words I would like to suggest that some users may want to directly change the state of content to "published" and not delete it. Or are you deleting only the states and not the content itself which was set to be in one of these states? Also if only the states are deleted what will happen to content which was set to any of the states - to me personally this is not clear. Probably I am not able to understand the whole picture.
Comment #10
timmillwood@Daniel Kanchev - I think we should provide two options, just "save" and "save and delete moderation states". Deleting moderation states will just delete all ContentModerationState entities for that bundle.
The patch #3 adds the bundle id to the ContentModerationState, therefore it will only work for ContentModerationState entities created after this update. Maybe we'd be better running an entity query to get the entity IDs we wish to delete.
We shouldn't need to change the published state of anything.
Comment #12
yoroy commentedFor whom is this a problem in the first place? I don't think content editors would care, or is there a scenario where this could bite them sometime later?
Do site builders care? How does not deleting the moderation state entities impact their work?
Do developers care? Probably yes or this issue wouldn't exist :-). Do they need a UI for this?
To me it seems super technical to first make people understand that actually, the moderation state your content was in is stored in separate thingies that are now unused and do you want to delete them? “I don't know!” :-)
Lets first establish if, and if so, why, we need to make this a task for the user to make a decision about.
Comment #13
timmillwoodContent editors should care, but maybe not enough to select between two options.
The UI of this has changed in 8.3.x and may change further with #2843083: Select entity type / bundle in workflow settings, but we still need to know what to do with the data.
Maybe we just decide, much like when you uninstall a module all data relating to that module is deleted, then you remove an entity type from moderation all data relating to that entity type for moderation is deleted?
Comment #14
yoroy commented*Why* should content editors care though? :)
My initial assumption was indeed that it could work similar to uninstalling modules. You lose the settings related to moderation because you disabled it. But there is a difference between uninstalling and disabling. I'm trying to find out if there's a reasonable scenario where you'd expect your moderation settings to magically reappear when you turn moderation on again.
Comment #15
timmillwoodIf we remove moderation states when disabling moderation the following scenario would happen:
You set node/1 to state "Needs review" then disable moderation for nodes, then enable it again, node/1 will get the state "default"
Currently enabling moderation again you'd get the "Needs review" state back for node/1.
Uninstalling Content Moderation removes all states from all entity types.
Comment #16
eaton commentedThis seems similar to the "Deleting an Image Style" scenario. In that case, we allow admins to select a replacement image style and shift any references to the replacement. This is a bit different, but letting admins choose which states should map to "Published" and which ones should map to "Published" seems like the best approach to avoid accidents.
Comment #17
timmillwoodThis issue relates specifically to disabling moderation on a bundle, not removing a state, so no mapping needs to be done.
In #2817835: When enabling moderation apply a relative state we're looking to return relevant states, and in #2867312: Create a batch process to ensure entities that exist for newly moderated entity types get a corresponding ContentModerationState entity, so that views works. we're actually looking to store this data. So the issue I outlined in #15 will be less of an issue.
I wonder if there's any concern around just leaving the moderation data there?
Comment #18
yoroy commentedFrom an editor’s perspective I don't think there’s a problem with leaving it around. I assume it’s mostly about programmatically cleaning up after ourselves? But it seems like there’s value in keeping these around.
Comment #19
timmillwood@yoroy - sounds fine to me.
Lets just leave them there.
Comment #20
chartmann commentedDoesn't anyone else have the issue of View related duplicates after uninstalling Workbench moderation on a multilingual site? I've already dealt with using language filters to deal with multilingual duplicates, and it now seems the only duplicates that are showing up, are those with no revision information.
Comment #21
rick_p commentedI want to upgrade core beyond 8.2.7 on a production site, but Content Moderation must be disabled first. https://www.drupal.org/node/2869631
Content Moderation cannot be disabled until the states of all nodes are removed (There is content for the entity type: Content moderation state. Remove content moderation states) but the link to remove Content moderation state returns an error (The website encountered an unexpected error. Please try again later.).
Losing all the states, or having them all default to published is rather problematic but it is what it is, I guess we'll have to do a lot of preparation if we want to restore things manually later.
I found the following thread that has a patch to assist with uninstalling the content moderation module. Is the the only way to get past the issue so that I can upgrade core? https://www.drupal.org/project/workbench_moderation/issues/2627012
Any assistance greatly appreciated. Rick
Comment #22
vincenzo gambino commentedHi all,
Recently I have tried to remove an early created workflow. The workflow type hasn't got any entity type assigned to it now but it was assigned to some content types in the past and some content is using it.
When I tried to delete the workflow type, I got the message "This workflow is in use. You cannot remove this workflow until you have removed all content using it."
I don't want to delete the content as the content type is assigned to a new Workflow.
To do that, I have created an update script similar to the one in the current patch where it deletes all the content_moderation_state entries for a particular Workflow type.
Now I can delete the Workflow type.
Will this cause any issue to the site?
Comment #23
pavlosdanRe-opening this because it seems that the stale workflow entities left on the content type are causing issues. Namely, the workflow cannot be deleted and gives the message:
This also breaks configuration management as the config import will fail with the same message as above when it attempts to delete the workflow on the site that had it before but can't.
Comment #24
ravi.shankar commentedHere I have tried to add reroll of patch #2 on Drupal 9.3.x.
Comment #25
yogeshmpawarResolved CSpell errors
Comment #27
smustgrave commentedThis issue is being reviewed by the kind folks in Slack, #need-reveiw-queue. We are working to keep the size of Needs Review queue [2700+ issues] to around 200, following Review a patch or merge require as a guide.
This seems more like a feature request and will need a test case for it
Thanks.
Comment #29
ravi.shankar commentedFixed Drupal CS issue of patch #25, still needs work for comment #26,