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
On entities with the moderation form displayed when viewing the entity the form does not display if entity is in initial draft.
Note this issue came from workbench_moderation where it is being fixed in #2733127: Can't moderate new content - moderation controls don't appear on new nodes.
Proposed resolution
Change the check in EntityOperations::entityView to hide the form if the entity is the live revision, rather than if it is the default revision.
Remaining tasks
Review code
User interface changes
None
API changes
None
Data model changes
None
Comment | File | Size | Author |
---|---|---|---|
#21 | 2864938-21.patch | 3.68 KB | timmillwood |
#12 | brand_new_article_draft.png | 46.55 KB | Sam152 |
#12 | old_article_draft.png | 53.59 KB | Sam152 |
#12 | after_published.png | 35.66 KB | Sam152 |
Comments
Comment #2
fenstratFailing tests.
Comment #3
fenstratFix with tests.
Comment #4
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedThe docblock on this method would indicate this change makes total sense. Nice.
Maybe the comment shouldn't use "published view" because the case we are fixing is specifically a draft, unpublished revision. Maybe "canonical view" is better given the variable name.
Maybe ::assertField would be a better assertion for if the moderation form exists or not. "Status" feels like it could drift into false positive territory.
Comment #6
fenstrat@Sam152 cheers for the review!
I should get to this later today.
Comment #7
fenstratassertText('Draft'...
forassertField('edit-new-state'
to avoid false positives.Comment #12
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedManual testing looks good. I don't think this needs a usability review as it's a bug fix that makes things more consistent. Amended workflow looks like:
Brand new article in a draft state:
After it has been published:
Once it's back in a draft state:
I like it, looks good.
Comment #13
timmillwoodNot sure what is the best direction #2815921: Allow to use the EntityModerationForm on non forward revision pages
Comment #14
dawehnerAt least from a user point of view being able to see it on draft only content totally makes sense.
Comment #15
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedComment #16
timmillwoodJust comparing the patch here and the patch in #2815921: Allow to use the EntityModerationForm on non forward revision pages, I think this is a better implementation.
Comment #17
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedHaving also reviewed both of these patches again, I think they are functionally exactly the same. The reason being, for any revision with a published state we also force that revision to be the default revision.
Hence I believe:
will have the exact same outcomes as:
Comment #18
jhedstrom@timmillwood pointed me here from #2870484: No way to moderate content that hasn't been published already.
I tested this approach, and while it addresses the issue of new content, it doesn't allow for moderating content out of a published state (which might only apply to advanced workflows).
Comment #19
alexpottNeeds a reroll.
Comment #20
timmillwoodComment #21
timmillwoodHere's the reroll.
Comment #24
catchCommitted/pushed to 8.4.x and cherry-picked to 8.3.x. Thanks!
I thought about the case in #16, but I think that's a behaviour change/feature as opposed to a bug fix (which I agree this is).
Comment #25
jhedstromI've added #2875843: Display content moderation form on published revisions as a follow-up, and marked #2870484: No way to moderate content that hasn't been published already as a duplicate of this.