Cms: FR: Ability to permanently delete soft-deleted elements from the CP

Created on 19 Jun 2019  ·  15Comments  ·  Source: craftcms/cms

Description

We ran into an issue today where we were testing some functionality involving users. We would delete the users and try to re-signup a user; however, that won't work as expected if the email addresses are the same. This is because the user is just in a trashed state. Ideally, one could select a particular trashed element and delete it permanently.

Edit
Looks like there's something else going on with the user registration issue, so that may be unrelated. I think a module was malfunctioning and created some duplicate data. The feature request should still be valid though.

Additional info

  • Craft version: 3.1.30
  • PHP version: N/A
  • Database driver & version: N/A
  • Plugins & versions: N/A
enhancement

Most helpful comment

@romainpoirier Just made that possible for the next release.

All 15 comments

+1. Most systems that have a "trashed/recycle bin" option for their content have a hard delete option (I.E the recycle bin on Windows or Google drive). We have had collisions with our custom element types in the past that this FR would solve.

@brandonkelly agree? If so i have some time to get a PR in for this over the weekend for BETA4. Shouldnt be difficult to add anyway.

It’s already possible to add a new user with the same username or email as a soft-deleted user. Craft only looks at non-soft-deleted users when validating their uniqueness.

@brandonkelly I did discover that as well after creating this ticket, hence my update; however, do you think there's still value in having an "empty trash" or "permanently delete" type option for trashed elements?

It’s possible with the ./craft gc command. Either answer yes at the Delete all trashed items? prompt, or pass the --delete-all-trashed option.

Unless you are specifically needing to run it from the Control Panel? Our reasoning for not including that has just been that it’s not really needed since the items will go away eventually per the softDeleteDuration config setting.

@brandonkelly I was specifically talking about doing it in the CP, as I try to avoid using SSH on staging & production environments. I think your reasoning makes sense and it is something that doesn't come up very often, but on the other hand, it does does feel like a fairly important/minimal impact feature and it makes me wonder about compliance implications when it comes to things such as GDPR & COPPA which do not leave room for soft-deletes.

@Mosnar Beat me to it with GDPR :)

I see two reasons for including it:

  1. Convention: See my example above. It's just logical to have this as an option. Not the best argument but for other use cases people might have, i feel it's valid ¯_(ツ)_/¯.
  2. GDPR and those pesky compliance laws: In addition to @Mosnar 's point i have a use case filling it in. In one of our apps we have signed up users. Once they cancel their subscription we delete their account. They then have 30 days to re-activate their subscription. softDeleteDuration is set to thirty with us. Some people (one has done it so far) might invoke their "right to be forgotten" in which case we need to, by law, remove their personal data. Now for this case i deleted the user manually but a hard-delete button really should be placed along side the restore button. SSH'ing into the DO box isn't a "scalable" solution IMO.

Arguably its a YAGNI case but especially the GDPR scenario seems like a valid reason?

Any news on this?

I had the problem with the Campaign plugin: I had plenty of contacts in Bounced status because of a bug with Mailgun, so I deleted all these Bounced contacts to reimport them in Active status, but it failed because they were in "Trashed" status and I cannot recreate a contact with an already used email.

2020-02-20 13:18:48 [][1][info] Line 3205: Contact Email "[email protected]" has already been taken.

I would like the "Permanently trash" button for sure :).

@migswd Sounds like a bug with the Campaign plugin. Can you post an issue over there? Once you do I can comment on it with details on how to fix.

@brandonkelly Not so much a bug as intended behaviour to ensure that multiple contacts cannot have the same email address. I'll probably follow suit with how Craft allows trashed and non-trashed users with the same email address, but I believe @migswd is asking for an update on the ability to permanently delete trashed elements.

Yes thank you @bencroker, I confirm, my request is about having the ability to delete permanently the contacts that are trashed... so I can reimport those contacts with an active status.

Just added a “Delete permanently” action for soft-deleted elements, for Craft 3.5.

Four soft-deleted entries selected, revealing the new “Delete permanently” element action

In the name of GDPR, thank you Brandon!!

@brandonkelly, why the “_Delete permanently_” button is not available for Users (under /admin/users)? I can only see a _Restore_ button in the _Trashed_ view.

That's a shame for cases where there're plenty of SPAM fake-users accounts, or for GDPR reasons where a real complete deletion is required.

I checked this under Craft CMS Pro 3.5.19.1 and 3.6.4.1. No special setting regarding users are set in my general/config.php files.

@romainpoirier Just made that possible for the next release.

Craft 3.6.5 is out now with user hard-deletion ✨

Was this page helpful?
0 / 5 - 0 ratings