Add a config action to add entity types and bundles to a Content Moderation workflow

Created on 21 February 2024, 9 months ago
Updated 8 April 2024, 8 months ago

Problem/Motivation

This would be a great way to add content moderation to a particular content type, or set of bundles:

config:
  actions:
    workflows.workflow.editorial:
      addNodeTypes: [page, article]
      addTaxonomyVocabularies: '*'

Remaining tasks

Implement that with test coverage.

User interface changes

TBD. Should be none.

API changes

TBD.

Data model changes

TBD, but shouldn't be any.

✨ Feature request
Status

Fixed

Version

11.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @phenaproxima
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    Honestly...on second thought, we might not need this to be generic at all. It's probably easier to just expose the plugin-specific actions we need, in the modules that provide them.

  • Pipeline finished with Success
    8 months ago
    Total: 258s
    #120439
  • Status changed to Needs work 8 months ago
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts
  • Status changed to Needs review 8 months ago
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts
  • Pipeline finished with Success
    8 months ago
    Total: 223s
    #120448
  • Pipeline finished with Canceled
    8 months ago
    Total: 34s
    #120449
  • Pipeline finished with Success
    8 months ago
    Total: 190s
    #120450
  • Status changed to RTBC 8 months ago
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    Beautiful! 😍 Zero remarks.

  • Status changed to Needs work 8 months ago
  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    We're not running this test or scanning this code. See .recipes.gitlab-ci.yml - you need to add the directories to the TEST_DIRECTORIES and CODE_DIRECTORIES - also can you move the test into it's own directory in the content_moderation module so that it is separate.

  • Pipeline finished with Failed
    8 months ago
    Total: 252s
    #126764
  • Pipeline finished with Success
    8 months ago
    Total: 383s
    #126765
  • Status changed to RTBC 8 months ago
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    Nice catch; fixed.

    Since this was not a substantive code change, flipping this back to RTBC.

  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    I'm wondering something... what happens if a recipe enables content_moderation and uses this plugin in the same recipe - will that work? How does recipe validation work when the action plugin does not exist yet?

  • Status changed to Needs work 8 months ago
  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    Plus we need to convert this to an ConfigAction attribute now

  • Pipeline finished with Canceled
    8 months ago
    Total: 373s
    #126950
  • Pipeline finished with Canceled
    8 months ago
    Total: 72s
    #126953
  • Status changed to Needs review 8 months ago
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    Converted to an attribute!

    Regarding #11, this is something we added test coverage for in #3423523: Test that recipe runner fails and rolls back if a recipe tries to use a non-existent config action β†’ . The recipe runner will fail because the plugin does not exist.

    That said, the plugin will exist the moment the providing module is installed by the recipe. I've changed the test to prove this; it now installs Content Moderation and Workflows, and creates the editorial workflow (copied from the Standard editorial_workflow recipe), before using the config action.

  • Pipeline finished with Success
    8 months ago
    Total: 384s
    #126954
  • Pipeline finished with Success
    8 months ago
    Total: 387s
    #127064
  • Status changed to Needs work 8 months ago
  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    Just one review comment left

  • Status changed to Needs review 8 months ago
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts
  • Pipeline finished with Failed
    8 months ago
    Total: 508s
    #127117
  • Pipeline finished with Success
    8 months ago
    Total: 419s
    #127155
  • Status changed to Needs work 8 months ago
  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    I've added the new plugin directory to the list of things to be scanned and there are some things to fix.

  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    Come on, this is no fair.

    PHPStan is giving me errors like this one, in AddModeration.php:

    32     Method                                                                                
             Drupal\content_moderation\Plugin\ConfigAction\AddModeration::create()                 
             has parameter $configuration with no value type specified in iterable                 
             type array.                                                                           
             πŸ’‘ See:                                                                               
                https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type  
    

    This is in reference to a completely standard implementation of ContainerFactoryPluginInterface::create().

    What exactly am I supposed to do here?? $configuration is unused, and the interface docs (which I can't change) just specify a type hint of array.

    This feels like too many pointless hoops to jump through.

  • Pipeline finished with Failed
    8 months ago
    Total: 418s
    #127382
  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    @phenaproxima it just goes in the baseline and we forget. I do this that we should comment on the level 9 for core issue to show how disruptive this will be for adding new work to core.

    FWIW the phpstan level 9 job has a baseline for you to download with all the errors included - which you can download and commit and then the job will be green.

  • Pipeline finished with Canceled
    8 months ago
    Total: 79s
    #128695
  • Pipeline finished with Failed
    8 months ago
    Total: 386s
    #128697
  • Pipeline finished with Success
    8 months ago
    Total: 552s
    #128732
  • Status changed to Needs review 8 months ago
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    Fixed what I could, but altered the baseline as well to account for core's non-compliance. Finally we're passing!

  • Pipeline finished with Canceled
    8 months ago
    #128765
  • Pipeline finished with Success
    8 months ago
    Total: 496s
    #128766
  • Status changed to RTBC 8 months ago
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    Everything in the last couple of days was just coding standards-related; I don't think I made any substantive changes.

  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    Committed and pushed b4fc09885e2 to 11.x and 20a2005e57e to 10.3.x. Thanks!

    • alexpott β†’ committed 20a2005e on 10.3.x
      Issue #3422821 by phenaproxima, alexpott: Add a config action to add...
  • Status changed to Fixed 8 months ago
    • alexpott β†’ committed b4fc0988 on 11.x
      Issue #3422821 by phenaproxima, alexpott: Add a config action to add...
    • e3b3e96e committed on patch
      Update recipe 10.3.x patch 20a2005e Issue #3422821 by phenaproxima,...
    • 4856f52a committed on patch
      Update recipe 11.x patch b4fc0988 Issue #3422821 by phenaproxima,...
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024