We should not delete flaggings on account cancelation

Created on 16 May 2015, over 9 years ago
Updated 4 November 2024, 30 days ago

We should avoid deleting data on user cancel.

To quote from the Drupal API https://api.drupal.org/api/drupal/modules%21user%21user.api.php/function...

"the module should either do nothing, unpublish content, or anonymize content" ... it should not be deleting user data.

Right now we have this code removing all the flag when user cancel their account.


/**
 * Implements hook_user_cancel().
 */
function flag_user_cancel($edit, $account, $method) {
  flag_user_account_removal($account);
}
🐛 Bug report
Status

Needs review

Version

4.0

Component

Flag core

Created by

🇨🇭Switzerland gagarine

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • @eelkeblok opened merge request.
  • 🇳🇱Netherlands eelkeblok Netherlands 🇳🇱

    Over four years onward, I needed a more nuanced implementation, here's a stab at it. This only deletes flaggings when re-assigning content to the anonymous user (deleting a user will already call the existing pre-delete hook). Also, it checks the number of flaggings to remove to a threshold, and will create a queue to delete the flaggings in batches when it exceeds the threshold. The threshold itself is obviously up for debate, maybe the current 20 is a bit too convervative.

Production build 0.71.5 2024