Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Content moderation has been marked as stable in Drupal 8.5.0. We should showcase it in Umami!
Proposed resolution
Enable Workflows and Content Moderation on install. Create separate roles, users and workflows to demonstrate a publishing workflow enforced by Content Moderation.
Remaining tasks
Create example editor users.
Add all node types to the workflow on install.
User interface changes
None.
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#36 | Screen Shot 2018-07-27 at 10.51.21.png | 16.83 KB | markconroy |
#36 | Screen Shot 2018-07-27 at 10.53.07.png | 372.87 KB | markconroy |
#35 | interdiff-2953376-32-35.txt | 5.46 KB | chr.fritsch |
#35 | 2953376-35.patch | 29.95 KB | chr.fritsch |
#32 | interdiff_28-32.txt | 518 bytes | anmolgoyal74 |
Comments
Comment #2
Eli-THere's a start! This patch
When workflow is enabled, it automatically creates an example workflow called Editorial which I think is adequate for our needs. However if I try to apply in to the relevant entity types, the exported workflows.workflow.editorial config entity will no longer apply on installation, raising the error message
This is odd because the node.type.article, node.type.page, node.type.recipe config entities are already in our configuration.
Comment #3
Eli-TComment #4
Eli-TComment #5
markconroy CreditAttribution: markconroy as a volunteer and at Annertech commented@Eli-T,
I'm going to mark this as postponed for now, and let's revisit it asap once we get unhidden. I think this will make a great feature (and others are free to work on it in the meantime if they wish).
I am attaching the 'Umami new feature' tag to this item.
Comment #6
markconroy CreditAttribution: markconroy as a volunteer and at Annertech commentedComment #7
martin_qRelated: #2983591: Add example.com email addresses to users created during Umami install
Comment #8
John Cook CreditAttribution: John Cook at Creode commentedI didn't get the error reported in #2 when I used the patch. I suspect it was fixed in other issues.
The patch from #2 sets up the workflow but it wasn't enabled on the content type.
I've made a new patch that has the workflow enabled on article, page, and recipe content types.
Comment #9
John Cook CreditAttribution: John Cook at Creode commentedI've looked through the permissions they all OK. Authors can create new content but not make it published, while editors can view content that hasn't been published and then publish it.
The admin screen need to be styled when viewing them with the Umami theme.
The content listing (/admin/content) needs styling. And the "Add content" button is missing, and the user needs to go to /node/add to add content.
The /node/*/edit page needs to be looked at. Especially the "Edit summary" link on the body field.
When viewing an unpublished node, the workflow form appears. This should also be styled.
Comment #10
Eli-TWe can fix a bunch of the points in #9 by granting the author and editor roles access to the admin theme. Suggest doing that and retesting.
It's likely the workflow form will still need styling work though.
Comment #11
markconroy CreditAttribution: markconroy as a volunteer and at Annertech commentedI don't think we should expand the scope of this to the styling of the Umami theme as an admin theme. It is not an admin theme and we have not done any work on it to make it one.
Those issues - if we want to look at them - can be dealt with in follow up issues.
Setting to 'Needs work' so we can add permission for editor and author roles to use the admin theme.
@Eli-T - should we create a new issue for the workflow form styling? It's likely that the folks working on this issue will not be the same folks working on the CSS for that.
Comment #12
Eli-T@markconroy it's a bit of a weird one - workflow by default adds a form to the top of nodes when being viewed so users with the correct permission can change their state. However, there's an alternative where you can change the workflow status on the edit page. So we could use block configuration to remove that form from the view and rely on people editing it in this issue. Then consider in a separate issue if we want to style and reinstate it.
How does that sound?
Comment #13
markconroy CreditAttribution: markconroy as a volunteer and at Annertech commentedI think that sounds like a sensible approach - graceful degradation, let's call it!
It means we get this cool feature in sooner, and progressively enhance it later.
Comment #14
Eli-TApologies - I was slightly wrong in #12. The form is removed in the field display settings for each content type, not in block config.
Here is a patch that does that, and grants access to the admin theme to the new Author and Editor roles.
Comment #16
Eli-TPatch that should actually apply (InstallHelper class on 8.6.x changed after generating the original).
No interdiff as interdiff doesn't want to play nicely for some reason.
Comment #17
John Cook CreditAttribution: John Cook at Creode commentedThe patch from Eli-T in #16 prevents the need to style admin pages by letting the editors and authors view the admin theme.
The Moderation control form still appears, though. This is because it is set to be visible on the other view modes. Because of this, I'm setting this issue back to needs work.
Comment #18
Eli-TGood catch @John Cook! Here's another patch that disables the moderation status field for all node display modes.
Putting to Needs Review so someone can verify comments to date have been addressed, but I think we should also consider adding a user with the Editor role with this change too, because as is, you can't create an article and publish it (or publish a new draft of an existing article) without using the admin user. Maybe even two extra users, one with just the Editor role and one with both Author and Editor.
Similarly we should consider paring down the permissions granted to the Authenticated role, as it would be made rather redunandant.
Comment #20
markconroy CreditAttribution: markconroy as a volunteer and at Annertech commentedMight be nice in a future release to allow authenticated users to post comments without approval, and to use the advanced search (just to show off how cool the permissions system is in drupal)
Comment #21
Gábor Hojtsy1. I agree to hide the moderation controls for now, but it would be really useful to reinstate it as it is a nice in-place experience where you can actually see what you are moderating as opposed to backend where the form chrome is distracting. Separate issue though. I created one at #2985551: Style and show content moderation form in Umami.
2. I think the approach taken here to add an author and editor roles is good. Adjusting authenticated user roles can also be a followup. I think moderator needs to be able to create draft from published as well, that permission is missing.
It would be nice to swiftly get this in and then work on perfecting the experience. For that the access fails needs to be resolved, the current fails seems to indicate there is a permission issue.
Comment #23
Eli-TOne of the test fails is due to the the moderation form component not being removed from entity edit forms. This patch explicitly removes it.
Putting back to needs review, but expected the other permissions based test failures will still fail.
Comment #25
Eli-TFixes the remaining test fails.
Still need to create a couple of editors.
Comment #26
Eli-TThis patch adds the editors and completes the functionality as envisaged.
I'd suggest someone tests and looks at how the different roles interact now we have content moderation configured like this.
For example, authors can create new articles, and create new drafts of their own articles, but not create new drafts of articles created by other users. Is that too restrictive? What other details do we need to consider?
Note before this patch/issue, the non-admin users had no role other than Authenticated User, and couldn't do anything other than log in.
Comment #27
Gábor HojtsySome nitpicks, some followup:
Extra newline
Let's leave these as-is. I can see how its re-weighted once saved, but for easier diffs with standard, it would be nice to keep as-is.
Normally I think page creation would be separate from article/recipe authoring, but it would be overkill to add even more roles, so this should be fine.
Last time I looked the terms widget did not allow to create new, so authors would need to go to a different UI to create the terms, this is super confusing.
Also categories were chosen in a textfield rather than a dropdown. I think both of these are fixable as a standalone issue, just noting that giving authors the tag creation permission does not make them able to create tags if the widget does not allow them to :)
Comment #28
anmolgoyal74 CreditAttribution: anmolgoyal74 at OpenSense Labs for DrupalFit commentedComment #29
anmolgoyal74 CreditAttribution: anmolgoyal74 at OpenSense Labs for DrupalFit commentedComment #31
Gábor HojtsyErm, I did not suggest this to be removed?!
Comment #32
anmolgoyal74 CreditAttribution: anmolgoyal74 at OpenSense Labs for DrupalFit commentedmy bad, I misinterpret the suggestions in #27.
Comment #33
anmolgoyal74 CreditAttribution: anmolgoyal74 at OpenSense Labs for DrupalFit commentedComment #34
markconroy CreditAttribution: markconroy as a volunteer and at Annertech commentedHi @anmolgoyal74
The 'moderation state' widget needs to be positioned for each content type on the 'Manage Form Display' page, and the widget needs to be set as "moderation widget' not 'text field'.
When that is complete, I think this is ready for RTBC.
Comment #35
chr.fritschAdded the moderation widget to article, recipe and page type.
Comment #36
markconroy CreditAttribution: markconroy as a volunteer and at Annertech commentedMoving to RTBC.
Moderation form appears on node edit page:
Screenshot of article for an admin of an article with word "Updated" in title and article set to 'draft' state side by side with anonymous user version and title remaining at 'Published' state.
Comment #39
Gábor HojtsyYay looks good, thanks! I love that we have actual roles and users demonstrating moderation.