Abuse reports submitted against deleted users become orphaned
Summary
Deleting a user which has an absue report associated with them, causes the abuse report to become orphaned.
Steps to reproduce
Steps to reproduce:
- Create two news users, User A and User B
- Add both users as members of a new project
- In the project User A should create a new issue and add a comment
- User B should report the said comment
- Login as a an Admin (root) user in GitLab and go to
/admin/abuse_reports
and verify the abuse report - Delete User A from GitLab instance
- Wait a few minutes (so that Sidekiq runs the job of deleting User A)
- Go back to
/admin/abuse_reports
and observe that the abuse report is no longer listed in the list however the badge on the left hand side reports that there is an abuse report.
Example Project
What is the current bug behavior?
The abuse report and badge count is as expected
User Simon who made the abusive comment and was subsequently deleted as a user, note the badge count remains at 4 whilst the abuse report has been removed without any interaction with the UI. The abuse report becomes orphaned/ invisible
What is the expected correct behavior?
The missing abuse report should either be deleted or if not then the badge count should match the number of abuse reports in the list
Relevant logs and/or screenshots
Output of checks
Results of GitLab environment info
GitLab 16.11.2
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)
Possible fixes
You can delete the orphaned abuse report from the database directly gitlabhq_production=# Delete from abuse_reports where id=5;