Port "Block user" action to rules-8.x-3.x.

Comments

fago’s picture

Reviewed it: https://github.com/fago/rules/pull/96/files

Figured we've got an action for that in core already, not sure what's the best way to proceed here.

fago’s picture

Status: Active » Needs work

As discussed, let's add it for now. Code needs work though.

dasjo’s picture

Assigned: m1r1k » Unassigned

unassigning due to lack of activity, feel free to reassign :)

dasjo’s picture

Status: Needs work » Postponed
mariancalinro’s picture

Assigned: Unassigned » mariancalinro
Status: Postponed » Active
Issue tags: +drupaldevdays

Working on this at drupaldevdays Montpellier

mariancalinro’s picture

Assigned: mariancalinro » Unassigned
Status: Active » Needs review
fago’s picture

Status: Needs review » Needs work

see klausi's comments at PR.

klausi’s picture

Status: Needs work » Fixed

Committed, thanks!

  • klausi committed d361d3f on 8.x-3.x authored by m1r1k
    Issue #2317223 by mariancalinro, m1r1k: Port "Block user" action to D8
    
klausi’s picture

Status: Fixed » Needs work

Ooops, we forgot the auto saving of the user account if it gets blocked, see UserRoleAdd action for example.

reeller_sk’s picture

Assigned: Unassigned » reeller_sk
Status: Needs work » Needs review

PR: https://github.com/fago/rules/pull/199 with added autosaving made same way as it is in UserRoleAdd

klausi’s picture

Status: Needs review » Needs work

Cool, can you also expand the test case to make sure the ->autoSaveContext() returns the correct stuff when the action was executed?

reeller_sk’s picture

I have pushed the changes to the test case, it should be fine, but I wasn't able to run this test properly, because it dies on Mocked classes, any idea how to get rid of these errors?

reeller_sk’s picture

Status: Needs work » Needs review

  • klausi committed 8d29438 on 8.x-3.x authored by reeller_sk
    Issue #2317223 by reeller_sk: Fixed auto saving of user on User Block...
klausi’s picture

Assigned: reeller_sk » Unassigned
Status: Needs review » Fixed

Tests work for me and also succeeded on Travis CI, how did you try:

cd /path/to/drupal-8/core
./vendor/bin/phpunit ../modules/rules

Committed, thanks!

Status: Fixed » Closed (fixed)

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

Katy Jockelson’s picture

If I add an action of 'Block user' it wants a value for USER (Specifies the user that should be blocked) - what am I supposed to put here for a rule that targets a user where a custom field is changed? So it's not a a specific user, or a current user, it's just the user that the value got changed on.

I have tried 'user' and I get the error:

Error: Call to a member function id() on string in Drupal\rules\Plugin\RulesAction\UserRoleAdd->doExecute() (line 54 of /home/site/modules/contrib/rules/src/Plugin/RulesAction/UserRoleAdd.php)