-
-
Notifications
You must be signed in to change notification settings - Fork 824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[REF] CRM_Utils_Recent - Use hook listener to delete items #21204
Conversation
(Standard links)
|
98a784c
to
875aea7
Compare
@colemanw I just skimmed through this & obviously my take was that it really should have a test - but I know you've done a lot of PRs in this space just recently so wondering if you feel that you have otherwise covered it (or perhaps there already is a test) |
I don't think there are any tests at all for |
dev/core#2757
@eileenmcnaughton and now there is one :) |
PHP Fatal error: Cannot declare class api\v4\Action\ContactIsDeletedTest, because the name is already in use in /home/jenkins/bknix-dfl/build/core-21204-7ayeg/web/sites/all/modules/civicrm/tests/phpunit/api/v4/Action/ContactIsDeletedTest.php on line 81 |
Use array_filter() instead of brittle for() loops.
@@ -217,15 +217,6 @@ public static function deleteActivity(&$params, $moveToTrash = FALSE) { | |||
self::logActivityAction($activity, $logMsg); | |||
} | |||
|
|||
// delete the recently created Activity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just r-run tested this one & it worked (although the recent items block does require a screen refresh)
@@ -217,12 +217,6 @@ public static function deleteCase($caseId, $moveToTrash = FALSE) { | |||
|
|||
CRM_Utils_Hook::post('delete', 'Case', $caseId, $case); | |||
|
|||
// remove case from recent items. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r-run ++
@@ -1063,7 +1063,7 @@ public static function deleteContact($id, $restore = FALSE, $skipUndelete = FALS | |||
} | |||
|
|||
//delete the contact id from recently view | |||
CRM_Utils_Recent::delContact($id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep - tested all good - note that when soft deleting it gets a strike through & is removed on hard-delete
@@ -116,13 +116,6 @@ public static function discard($id) { | |||
$transaction->commit(); | |||
|
|||
CRM_Utils_Hook::post('delete', 'Group', $id, $group); | |||
|
|||
// delete the recently created Group | |||
$groupRecent = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r-run = OK
@@ -259,13 +259,6 @@ public static function del($id) { | |||
|
|||
$grant->find(); | |||
|
|||
// delete the recently created Grant | |||
$grantRecent = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r-run = ok
I did r-run on a handful of entities here and also stepped through the code. I thought it was great that you covered permissions in the test because I didn't think of that when doing r-run. It would be great to also CREATE the r-run entities in the post function but obviously that is scope creep! |
Overview
Simplifies a bunch of delete functions by de-coupling BAOs from the Recent Items menu/sidebar.
Before
BAO functions responsible for deleting their own items from the Recent menu/sidebar.
After
Recent items delete themselves.
Technical Details
This is toward dev/core#2757
Comments
All that's missing is
Note
which has a weirddel()
function. That's addressed in #21208