Move some Action plugins to Action module

Created on 11 January 2024, 11 months ago
Updated 28 March 2024, 9 months ago

Problem/Motivation

In the parent issue it was discovered that there are two tests that are not in the action module that are installing an Action. Following plugins are node_assign_owner_action, node_unpublish_by_keyword_action and comment_unpublish_by_keyword_action which may need the Actions UI module for configuration.

catch pointed out that those plugins don't make sense without a UI, so we should also consider moving them to the Action UI module. That is what this issue is for.

There is also user_add_role_action, user_remove_role_action which need configuration but they are managed by user module hooks user_user_role_insert() and user_user_role_delete()

For background, these are all the Action plugins in a core module.

  1. comment_unpublish_by_keyword_action
  2. node_make_unsticky_action
  3. node_make_sticky_action
  4. node_unpublish_by_keyword_action
  5. node_unpromote_action
  6. node_assign_owner_action',
  7. node_promote_action
  8. user_cancel_user_action
  9. user_add_role_action
  10. user_remove_role_action
  11. user_block_user_action
  12. user_unblock_user_action

Followup from #3343369-17: [meta] Tasks to deprecate Actions UI module →

Steps to reproduce

Review
Move remaining plugins

Proposed resolution

Move the following to the Action UI module.

Remaining tasks

Review

user_add_role_action, user_remove_role_action per @andypost in comment 26

this actions should stay in core as they are used by user_user_role_insert() and user_user_role_delete

node_assign_owner_action can be moved so proposed solution was updated.

User interface changes

API changes

Data model changes

Release notes snippet

📌 Task
Status

Fixed

Version

10.3 ✨

Component
Action  →

Last updated 2 months ago

No maintainer
Created by

🇳🇿New Zealand quietone

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

Merge Requests

Comments & Activities

  • Issue created by @quietone
  • Merge request !6120Move some Action plugins to Action module → (Closed) created by quietone
  • First commit to issue fork.
  • 🇺🇦Ukraine taraskorpach Lutsk 🇺🇦

    I've also moved the UnpublishByKeywordComment. It would be good if you could take a look at it. By the way, the tests aren't running because an old plugin is missing.

  • Pipeline finished with Failed
    11 months ago
    #75926
  • Pipeline finished with Canceled
    11 months ago
    #76113
  • Pipeline finished with Canceled
    11 months ago
    #76119
  • Status changed to Needs review 11 months ago
  • 🇬🇧United Kingdom catch

    Looks like there's something to review here. The test coverage changes will conflict with 📌 Move non-migrations tests to Actions module Needs work .

  • Status changed to Postponed 11 months ago
  • 🇺🇸United States smustgrave

    Think this is postponed until the tests move. Unless we temporarily fix tests here and then fully remove in 📌 Move non-migrations tests to Actions module Needs work but that doesn't sound right.

  • Status changed to Needs review 11 months ago
  • 🇳🇿New Zealand quietone

    Since a core committer set this to needs review stating that "there's something here to review". I am setting this back to needs review.

    For myself, I see that the moving of the plugins can be removed. And also the remaining tasks identifies more plugins that need to me. The fact that a conflict will happen should not stop this work which we would like to complete in 10.3.

  • 🇺🇸United States smustgrave

    Alright I’ll tag and leave for someone else from the initiative to review. But appears there are test failure.

  • First commit to issue fork.
  • Assigned to spokje
  • Status changed to Needs work 11 months ago
  • 🇳🇱Netherlands spokje

    I don't want to mees up the MR created by @taraskorpach so I started a new one.

  • Pipeline finished with Failed
    11 months ago
    #79789
  • 🇳🇱Netherlands spokje

    Spokje → changed the visibility of the branch 3413949-move-some-action-other-approach to hidden.

  • Issue was unassigned.
  • Status changed to Needs review 11 months ago
  • 🇳🇱Netherlands spokje

    Sorry for the noise, my approach turned out to be the same approach. Closed and hid my MR.

    So the reason the MR fails lies in the migration subsystem, I think NR is a nice status to attract some attention from people with Big Brains who know about that stuff.

  • Pipeline finished with Failed
    11 months ago
    #79799
  • Pipeline finished with Failed
    11 months ago
    #76121
  • Pipeline finished with Failed
    11 months ago
    #81208
  • Status changed to Needs work 11 months ago
  • 🇺🇸United States smustgrave

    📌 Move non-migrations tests to Actions module Needs work has been merged, didn't check to see if this MR is rebased fully but there should be no conflict now but there are currently test failures.

  • Pipeline finished with Failed
    11 months ago
    #81965
  • Pipeline finished with Failed
    11 months ago
    #82193
  • Pipeline finished with Failed
    11 months ago
    #82199
  • Pipeline finished with Success
    11 months ago
    #82203
  • Status changed to Needs review 11 months ago
  • 🇳🇿New Zealand quietone

    I often forget about the action migrations because they are in the system module. They were failing because the moved plugins were no longer found. To fix this the first step was to prevent the existing action migrations, d6_action and d7_action, from migrating these two plugins (See the use of the static_map plugin in the process pipeline). Then in the action module add a hook_migration_plugins_alter to alter the static map so these plugins will migrate. Tests have been added and changed accordingly for this.

    And then all the migration Upgrade tests action entity counts are updated for 2 less Action plugins being migrated.

  • 🇳🇿New Zealand quietone

    On reflection, I am not sure why I listed those other plugins to be moved.

  • 🇳🇱Netherlands spokje

    On reflection, I am not sure why I listed those other plugins to be moved.

    Looking at the IS:

    catch pointed out that those two plugins don't make sense without a UI, so we should also consider moving them to the Action UI module. That is what this issue is for.

    Where the two mentioned action plugins are node_unpublish_by_keyword_action and comment_unpublish_by_keyword_action.

    The other plugins as mentioned by @quietone in #17 📌 Move some Action plugins to Action module Needs review are:

    user_add_role_action, user_remove_role_action, node_assign_owner_action which need configuration.

    I think the question here is, do these three plugins make sense without a UI?

  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    I think the question here is, do these three plugins make sense without a UI?

    I think from the point of view of minimizing disruption, the answer is "yes".

  • 🇺🇸United States smustgrave

    So if it's determined they need a UI what's next steps here?

  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    I did not say that? I said the plugins still make sense even without a UI — because the functionality will keep working even if a UI is only provided after installing a contrib module.

    (Similar example for core: https://www.drupal.org/project/restui → )

  • Status changed to Needs work 10 months ago
  • 🇳🇿New Zealand danielveza Brisbane, AU

    Just did a review of a MR, had a couple of small nits and some questions around the deprecations

  • Pipeline finished with Success
    10 months ago
    Total: 507s
    #92770
  • Pipeline finished with Failed
    10 months ago
    Total: 171s
    #106579
  • Pipeline finished with Success
    10 months ago
    Total: 582s
    #106582
  • Status changed to Needs review 10 months ago
  • 🇳🇿New Zealand quietone
  • Status changed to RTBC 10 months ago
  • 🇺🇸United States smustgrave

    Seems feedback has been addressed in the MR.

    For the concern about the namespace it should remain the same once removed to contrib. I checked VBO https://git.drupalcode.org/project/views_bulk_operations/-/blob/4.2.x/sr... who's namespace is Drupal\views_bulk_operations\Plugin\Action;

  • 🇦🇺Australia mstrelan

    Is there a follow up for the three other issues mentioned in the IS?

    user_add_role_action, user_remove_role_action, node_assign_owner_action

  • Status changed to Needs work 10 months ago
  • 🇫🇷France andypost

    re #25 this actions should stay in core as they are used by user_user_role_insert() and user_user_role_delete

    But node_assign_owner_action has tests in action.module so probably should be done here

  • Pipeline finished with Failed
    10 months ago
    Total: 644s
    #108568
  • Pipeline finished with Canceled
    10 months ago
    #108572
  • Pipeline finished with Canceled
    10 months ago
    Total: 29s
    #108574
  • Status changed to Needs review 10 months ago
  • 🇫🇷France andypost

    Deprecated node_assign_owner_action

  • Pipeline finished with Failed
    10 months ago
    Total: 178s
    #108575
  • Pipeline finished with Failed
    10 months ago
    Total: 682s
    #108577
  • Pipeline finished with Running
    10 months ago
    #108584
  • Pipeline finished with Failed
    10 months ago
    Total: 649s
    #108596
  • Pipeline finished with Canceled
    10 months ago
    Total: 516s
    #108600
  • Pipeline finished with Canceled
    10 months ago
    Total: 124s
    #108605
  • 🇫🇷France andypost

    Moved forgotten config schema to action module
    Few tests still fail after deprecation of node_assign_owner_action

    Removed strict types declaration as tests started to fail https://git.drupalcode.org/issue/drupal-3413949/-/pipelines/108578

        Drupal\Tests\action\Kernel\UnpublishByKeywordActionTest::testUnpublishByKeywordAction
        TypeError: str_contains(): Argument #1 ($haystack) must be of type string,
        Drupal\Core\Render\Markup given
        
        /builds/issue/drupal-3413949/core/modules/action/src/Plugin/Action/UnpublishByKeywordNode.php:33
        /builds/issue/drupal-3413949/core/lib/Drupal/Core/Action/ActionBase.php:22
        /builds/issue/drupal-3413949/core/modules/system/src/Entity/Action.php:152
        /builds/issue/drupal-3413949/core/modules/action/tests/src/Kernel/UnpublishByKeywordActionTest.php:66
        /builds/issue/drupal-3413949/core/lib/Drupal/Core/Render/Renderer.php:627
        /builds/issue/drupal-3413949/core/modules/action/tests/src/Kernel/UnpublishByKeywordActionTest.php:65
        /builds/issue/drupal-3413949/vendor/phpunit/phpunit/src/Framework/TestResult.php:728
  • Pipeline finished with Failed
    10 months ago
    #108608
  • Pipeline finished with Failed
    10 months ago
    Total: 557s
    #108615
  • Pipeline finished with Failed
    10 months ago
    Total: 594s
    #108619
  • Pipeline finished with Success
    10 months ago
    Total: 601s
    #108629
  • 🇫🇷France andypost

    Moved node_assign_owner_action

  • Pipeline finished with Success
    10 months ago
    Total: 605s
    #108637
  • Pipeline finished with Canceled
    10 months ago
    Total: 87s
    #108658
  • Pipeline finished with Success
    10 months ago
    Total: 709s
    #108660
  • Pipeline finished with Success
    10 months ago
    Total: 600s
    #108665
  • 🇫🇷France andypost

    Checked usage in contrib and the action has only few usages http://codcontrib.hank.vps-private.net/search?text=node_assign_owner_act...

    So I updated IS and CR to include node_assign_owner_action

  • Pipeline finished with Success
    10 months ago
    Total: 507s
    #110330
  • Status changed to Needs work 10 months ago
  • The Needs Review Queue Bot → tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

    This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

    Consult the Drupal Contributor Guide → to find step-by-step guides for working with issues.

  • Status changed to Needs review 10 months ago
  • 🇫🇷France andypost

    rebased

  • Pipeline finished with Failed
    10 months ago
    Total: 188s
    #110543
  • 🇫🇷France andypost

    Also fixed both plugins to use new render function 📌 Rename RendererInterface::renderPlain() to ::renderInIsolation() Fixed

  • Pipeline finished with Success
    10 months ago
    #110558
  • 🇫🇷France andypost

    It's the last blocker for 📌 Final steps to deprecate Actions module Postponed

  • Status changed to RTBC 9 months ago
  • 🇺🇸United States smustgrave

    Updated the issue summary to show 3 actions are moving and the other 2 are staying in core.

    Move of the 3 seems fine

    Marking now to get Actions deprecation finalized.

    • catch → committed 081b69b5 on 10.3.x
      Issue #3413949 by andypost, quietone, Spokje, taraskorpach, smustgrave,...
    • catch → committed 63a2ba06 on 11.x
      Issue #3413949 by andypost, quietone, Spokje, taraskorpach, smustgrave,...
  • 🇬🇧United Kingdom catch

    Committed/pushed to 11.x and cherry-picked to 10.3.x, thanks!

    I think for user_add_role_action, user_remove_role_action I think it's worth a follow-up to discuss. i.e. for me it's weird that user hooks call out to actions, user can directly use its own APIs in these cases. But that would be at least one issue to refactor user hooks to not depend on actions, then another to move them, so scope here seems fine.

    Committed/pushed to 11.x and cherry-picked to 10.3.x, thanks!

  • Status changed to Fixed 9 months ago
  • 🇬🇧United Kingdom catch
    • catch → committed 3de6ac2e on 10.3.x
      Revert "Issue #3413949 by andypost, quietone, Spokje, taraskorpach,...
    • catch → committed 2b44d584 on 11.x
      Revert "Issue #3413949 by andypost, quietone, Spokje, taraskorpach,...
  • Status changed to Needs work 9 months ago
  • 🇬🇧United Kingdom catch

    Reverted due to:

    OK (8 tests, 34 assertions)
    Remaining self deprecation notices (6)
      1x: The "Drupal\Tests\UnitTestCase::expectDeprecationMessage()" method is considered internal use expectDeprecation() instead. It may change without further notice. You should not extend it from "Drupal\Tests\comment\Unit\Action\UnpublishByKeywordCommentTest".
        1x in DrupalListener::endTest from Drupal\Tests\Listeners
      1x: The "Drupal\Tests\UnitTestCase::expectDeprecationMessageMatches()" method is considered internal use expectDeprecation() instead. It may change without further notice. You should not extend it from "Drupal\Tests\comment\Unit\Action\UnpublishByKeywordCommentTest".
        1x in DrupalListener::endTest from Drupal\Tests\Listeners
      1x: The "Drupal\Tests\UnitTestCase::expectDeprecationMessage()" method is considered internal use expectDeprecation() instead. It may change without further notice. You should not extend it from "Drupal\Tests\node\Unit\Action\AssignOwnerNodeTest".
        1x in DrupalListener::endTest from Drupal\Tests\Listeners
      1x: The "Drupal\Tests\UnitTestCase::expectDeprecationMessageMatches()" method is considered internal use expectDeprecation() instead. It may change without further notice. You should not extend it from "Drupal\Tests\node\Unit\Action\AssignOwnerNodeTest".
        1x in DrupalListener::endTest from Drupal\Tests\Listeners
      1x: The "Drupal\Tests\UnitTestCase::expectDeprecationMessage()" method is considered internal use expectDeprecation() instead. It may change without further notice. You should not extend it from "Drupal\Tests\node\Unit\Action\UnpublishByKeywordActionTest".
        1x in DrupalListener::endTest from Drupal\Tests\Listeners
      1x: The "Drupal\Tests\UnitTestCase::expectDeprecationMessageMatches()" method is considered internal use expectDeprecation() instead. It may change without further notice. You should not extend it from "Drupal\Tests\node\Unit\Action\UnpublishByKeywordActionTest".
        1x in DrupalListener::endTest from Drupal\Tests\Listeners
    

    https://git.drupalcode.org/project/drupal/-/jobs/1047019

  • Pipeline finished with Success
    9 months ago
    Total: 581s
    #117581
  • 🇫🇷France andypost

    11.x already has it

    docker exec \
    -u 1000:1000 \
    -e SIMPLETEST_BASE_URL=http://172.30.1.2 \
    -e BROWSERTEST_OUTPUT_DIRECTORY='db' \
    core \
    php -dzend.assertions=1 \
    vendor/bin/phpunit -c core/phpunit.xml.dist --colors=always --debug \
    --group OpenTelemetry
    PHPUnit 9.6.15 by Sebastian Bergmann and contributors.
    
    Testing 
    Test 'Drupal\Tests\demo_umami\FunctionalJavascript\OpenTelemetryAuthenticatedPerformanceTest::testFrontPageAuthenticatedWarmCache' started
    Test 'Drupal\Tests\demo_umami\FunctionalJavascript\OpenTelemetryAuthenticatedPerformanceTest::testFrontPageAuthenticatedWarmCache' ended
    Test 'Drupal\Tests\demo_umami\FunctionalJavascript\OpenTelemetryNodePagePerformanceTest::testNodePageColdCache' started
    Test 'Drupal\Tests\demo_umami\FunctionalJavascript\OpenTelemetryNodePagePerformanceTest::testNodePageColdCache' ended
    Test 'Drupal\Tests\demo_umami\FunctionalJavascript\OpenTelemetryNodePagePerformanceTest::testNodePageHotCache' started
    Test 'Drupal\Tests\demo_umami\FunctionalJavascript\OpenTelemetryNodePagePerformanceTest::testNodePageHotCache' ended
    Test 'Drupal\Tests\demo_umami\FunctionalJavascript\OpenTelemetryNodePagePerformanceTest::testNodePageCoolCache' started
    Test 'Drupal\Tests\demo_umami\FunctionalJavascript\OpenTelemetryNodePagePerformanceTest::testNodePageCoolCache' ended
    Test 'Drupal\Tests\demo_umami\FunctionalJavascript\OpenTelemetryNodePagePerformanceTest::testNodePageWarmCache' started
    Test 'Drupal\Tests\demo_umami\FunctionalJavascript\OpenTelemetryNodePagePerformanceTest::testNodePageWarmCache' ended
    Test 'Drupal\Tests\demo_umami\FunctionalJavascript\OpenTelemetryFrontPagePerformanceTest::testFrontPageColdCache' started
    Test 'Drupal\Tests\demo_umami\FunctionalJavascript\OpenTelemetryFrontPagePerformanceTest::testFrontPageColdCache' ended
    Test 'Drupal\Tests\demo_umami\FunctionalJavascript\OpenTelemetryFrontPagePerformanceTest::testFrontPageHotCache' started
    Test 'Drupal\Tests\demo_umami\FunctionalJavascript\OpenTelemetryFrontPagePerformanceTest::testFrontPageHotCache' ended
    Test 'Drupal\Tests\demo_umami\FunctionalJavascript\OpenTelemetryFrontPagePerformanceTest::testFrontPageCoolCache' started
    Test 'Drupal\Tests\demo_umami\FunctionalJavascript\OpenTelemetryFrontPagePerformanceTest::testFrontPageCoolCache' ended
    
    
    Time: 00:08.185, Memory: 144.00 MB
    
    OK, but incomplete, skipped, or risky tests!
    Tests: 8, Assertions: 0, Skipped: 8.
    
    Remaining self deprecation notices (1)
    
      1x: The Drupal\Tests\field\Traits\EntityReferenceTestTrait is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Instead, use \Drupal\Tests\field\Traits\EntityReferenceFieldCreationTrait. See https://www.drupal.org/node/3401941
        1x in FunctionalTestSuite::suite from Drupal\Tests\TestSuites
    
    
  • Status changed to Needs review 9 months ago
  • 🇫🇷France andypost

    It was old ctools in modules

  • Pipeline finished with Success
    9 months ago
    Total: 701s
    #117610
  • 🇫🇷France andypost

    Follow-up filed 📌 Stop using action in user module in role entity hooks Active (also found few related issues)

  • Status changed to RTBC 9 months ago
  • 🇳🇱Netherlands spokje

    Thanks @andypost for the removal of just the ExpectDeprecationTrait.

    • catch → committed 1c279bde on 10.3.x
      Issue #3413949 by andypost, quietone, Spokje, taraskorpach, smustgrave,...
    • catch → committed 7e81b860 on 11.x
      Issue #3413949 by andypost, quietone, Spokje, taraskorpach, smustgrave,...
  • Status changed to Fixed 9 months ago
  • 🇬🇧United Kingdom catch

    Also opened 📌 [PP-1] Move configurable user actions to the actions module Active as a follow-up to the follow-up, we can always decide not to do that, but I think it's worth discussing in its own issue (and also not trying to do here because it's not as simple).

    Committed/pushed to 11.x and cherry-picked to 10.3.x, thanks!

  • 🇫🇷France andypost

    Thanks, looks everything fine now and CR can be published

  • 🇫🇷France andypost

    Please close the MR and the remaining issue is 📌 Final steps to deprecate Actions module Postponed

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024