Problem/Motivation
There are two use cases content moderation should support which involve blocks:
- Moderating a reusable content blocks, through the normal content block creation screen.
- Moderating a whole page which is a combination of various block types, with inline block content created and treated as a composite to the whole page.
Currently when you switch on content moderation for content blocks, moderation widgets and semantics kick in for both use cases, where they should be disabled for the latter.
Proposed resolution
Inline blocks created and inserted into a layout are referenced by their revision ID from the layout storage by design, so there is very little reason to create new revisions or alter the publishing status of an inline block created for layout builder. Content moderation should not get involved for inline blocks.
I believe a good implementation may be allowing the moderation entity handlers to have a say in things like the visibility of the widget, to forcefully opt-out of some aspects of content moderation. I believe you could already switch off creating new revisions or updating the publishing status.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#27 | 3044292-27.patch | 9.22 KB | alexpott |
#27 | 10-27-interdiff.txt | 1.57 KB | alexpott |
#10 | 3044292-10.patch | 9.21 KB | Sam152 |
#10 | interdiff.txt | 6.87 KB | Sam152 |
#9 | interdiff_7-9.txt | 1.38 KB | johnwebdev |
Comments
Comment #2
johnwebdev CreditAttribution: johnwebdev commented+1 I think delegating if the entity is moderated to the Moderation handler is worth exploring.
Comment #3
BerdirMakes sense, we already have a pseudo-official of opting out entirely by unsetting the moderation handler, terms and menu_link_content is doing that now in 8.7, but not yet dynamically based on some condition.
Comment #4
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedMaking a start on this.
Comment #5
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedComment #6
johnwebdev CreditAttribution: johnwebdev commentedThe entity type actually returns the handler as a string. This should do it.
Comment #7
johnwebdev CreditAttribution: johnwebdev commentedwell, introducing whitespace doesn't, but this should :p
Comment #9
johnwebdev CreditAttribution: johnwebdev commentedFixing last tests. Had to update the mocks.
Comment #10
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedInterdiff from #4 since I rejigged the unit tests from that patch. Adding an integration test + the fix for inline blocks on moderated pages. By the looks of it, layout builder is the only way inline blocks are tested and used in core, so adding this to the CM/LB integration test seems to make the most sense to me.
Comment #11
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedReclassifying as a bug, since it's pretty easy to configure this from modules that are advertised to work together.
Comment #12
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedAdding a tag in the hopes of attracting some eyeballs :)
Comment #14
jhedstromI've re-queued the test. Assuming it's still green, this looks good to me. The addition of the
isModeratedEntity
method to the handler is a great solution, and will provide flexibility in the future for other entity types that want more granular control of which entities are moderated.Comment #15
larowlannit two spaces here, can be fixed on commit
Tagging for needs change record, adding a new method to the interface is allowed under the 1:1 rule, as it is expected that implementations will extend from the base class.
Comment #16
BerdirThis means that code that checks for this needs two check at least two methods now. What about deprecating shouldModerateEntitiesOfBundle() and testing that in isModeratedEntity() too?
Possibly as a follow-up?
Comment #17
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedI don't think it will be possible to deprecate, since there'll be contexts where there is no actual entity but decisions need to be made about entity types and bundles.
It does raise a good question though, should the
isModeratedEntity
handler method include an&&
on the return ofshouldModerateEntitiesOfBundle
. My initial feeling is: no, since this isn't designed as an API for callers but as an API for implementors.Comment #18
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedAdded the change record: New isModeratedEntity method added to moderation entity handlers
@Berdir any thoughts on #17?
Comment #19
BerdirWorks for me, that we sometimes don't have an entity is a fair point, and as I said, the actual API when having an entity is ModerationInformation::isModeratedEntity(), so nothing changes.
Comment #20
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedOkay great, thanks. Setting back to RTBC.
Comment #23
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedRandom fail.
Comment #25
larowlanCrediting @Berdir for reviews
Tagging this as bug-smash initiative as I've come back to it after it came up in our fortnightly meeting.
Fixed on commit
Committed 695846b and pushed to 9.1.x. Thanks!
Leaving as RTBC and moving to 9.0.x
Will poll other committers about a possible backport - the issue here is we're adding a new method - which we normally only do in a minor release - because in theory a handler may already have a similarly named method, but with a slightly different signature - and in that case a backport would break that.
Comment #26
jungleFYI here introduced a typo "apears" in core/modules/content_moderation/tests/src/Functional/LayoutBuilderContentModerationIntegrationTest.php
Comment #27
alexpottHere's a patch with the fixed spelling mistake and also a coding standards fix...
Comment #28
larowlanDiscussed this with @catch - as we're adding a new method here, there is risk of disruption. As this is only a normal bug, this will be 9.1.x only.
Thanks all.
Comment #29
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedThanks folks, I've published the CR.