-
-
Notifications
You must be signed in to change notification settings - Fork 825
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
dev/core#1753 - Attachments aren't deleted when deleting activity #17298
dev/core#1753 - Attachments aren't deleted when deleting activity #17298
Conversation
(Standard links)
|
727ece7
to
612594c
Compare
612594c
to
8ee4df1
Compare
jenkins retest this please |
1 similar comment
jenkins retest this please |
Yeah, IMHO, if the There are other cases which may sound similar - but don't apply, eg
|
I have replicated the issue and done an I did test with CiviCase:
Attachment is not deleted. @demeritcowboy is this expected? |
@kcristiano Thanks for testing and thanks for thinking of civicase. Yes it is expected because in civicase nothing is ever fully deleted. In the activities section on manage case there's a semi-hidden accordion called "Search Filters" above the table and in there is a "Deleted Activities" checkbox. If you click that you'll see the activity you deleted. If you want to see how that matches up in the code it's just a few lines down from the change I've made, around line 197 in the else block that handles "moveToTrash". |
Perfect. That makes sense and this looks good to merge. |
jenkins retest this please |
I have tested this PR. The file is removed when the activity is deleted. Attached screenshot is the result if you try to access it. I can't personally think of a reason that deleting an entity in CiviCRM with an attached file wouldn't remove the file from the filesystem as well. This is the same behavior of Drupal when a node is deleted for what it's worth. But that doesn't mean that someone hasn't come to expect or use a file behavior in their workflow one way or the other. I seems unlikely they would, but I am not certain with whom to even check. |
@demeritcowboy what do you think of the comment posted by @Stoob? If you agree we can ask @eileenmcnaughton or @mattwire to merge this. |
I'm +1 on merging this - I think people have kicked the tyres on it pretty well & tried to think of the edge cases. @kcristiano has given it 'merge-ready' which should mean 'this is mergeable but giving a little more time for people to comment' - so I'll solicit last comments - really last objections on chat in case anyone has some |
test this please |
Thanks everybody! |
Overview
https://lab.civicrm.org/dev/core/-/issues/1753
Also in the added test the last three asserts all fail.
Before
Deleting an activity leaves the attachments orphaned in the filesystem and database.
After
Deleting an activity also deletes the attachments.
Technical Details
Oversight?
Possibly there's a reason it didn't delete attachments - anybody know of one? The function call I've added checks the reference count in case it's shared with another entity, so it's only deleted from the filesystem if this is the last reference.
Comments
I thought I had seen this before a long time ago but (a) in CiviCase you never delete, and (b) it doesn't really come up for me personally for regular activities either, and (c) it's not something users would notice and report.