Users are deleted without prior notification when "Notification User Before Deletion" is enabled

Created on 25 April 2025, 3 days ago

Problem/Motivation

When the "Notification User Before Deletion" option is enabled, I expect all users to be notified before being deleted.
However, this is not happening. Users who have already exceeded the configured threshold (e.g., inactivity period)
are being deleted immediately without receiving any prior notification.
This defeats the purpose of the functionality, which is to give users a chance to take action after being notified.

This issue is especially problematic on live/production sites, where users may already exceed the inactivity threshold
at the time the feature is enabled, resulting in their immediate deletion without a chance to respond.

Steps to reproduce

  1. Enable the "Notification User Before Deletion" setting.
  2. Set a low threshold for inactivity before deletion.
  3. Ensure there are users who have already exceeded this threshold when cron runs.
  4. Run cron.
  5. Observe that users are deleted without being notified.

Proposed resolution

Add an extra validation step using the purge_users_notifications table.

Check if the user has already been notified and if the notification date has passed the configured waiting period.

Only allow the user to be deleted after this condition is met.

Remaining tasks

  • Add the new validation to the purge logic.
  • Ensure only users who were notified and have passed the notification wait time are deleted.
  • Write automated tests to cover this behavior.
  • Update documentation if needed.

User interface changes

No changes to the user interface are required.

API changes

No API changes are required.

Data model changes

No data model changes are needed, assuming the purge_users_notifications table is already used to store notifications.

🐛 Bug report
Status

Needs work

Version

4.0

Component

Code

Created by

🇵🇹Portugal saidatom Lisbon

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024