Skip to content
Snippets Groups Projects

Users without possible spam contributions can be deleted immediately

Merged Eugie Limpin requested to merge el-delete-user-without-contribs-immediately into master
All threads resolved!

What does this MR do and why?

Resolves https://gitlab.com/gitlab-org/modelops/anti-abuse/team-tasks/-/issues/386

When a user without possible spam contributions deletes their own account their record will be deleted immediately (without 7-day delay introduced by https://gitlab.com/gitlab-org/modelops/anti-abuse/team-tasks/-/issues/346).

Please read through this thread to have a better context for the changes in this MR.

New query

SELECT 1 AS one FROM "events" WHERE "events"."author_id" = 1614863 AND ("events"."action" = 6 OR "events"."action" = 1 AND "events"."target_type" IN ('Issue', 'MergeRequest')) LIMIT 1

Query plan: https://console.postgres.ai/shared/38f32daf-4299-4438-b0c0-880729d16448

How to set up and validate locally

  1. Turn on the feature flag
    $ rails console
    > Feature.enable(:delay_delete_own_user)
  2. Create a new user to delete
  3. Go to http://localhost:3000/-/profile/account then delete the account
  4. Validate that the user is deleted a few minutes later instead after 7 days
    > User.find(<id>)
    ActiveRecord::RecordNotFound: Couldn't find User with 'id'=<id>

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Eugie Limpin

Merge request reports

Merged results pipeline #892358639 passed

Pipeline: GitLab

#892368577

    Pipeline: E2E GDK

    #892385385

      Merged results pipeline passed for a8a83d0b

      Test coverage 82.33% (6.64%) from 2 jobs
      Approved by

      Merged by Pavel ShutsinPavel Shutsin 1 year ago (Jun 7, 2023 12:58pm UTC)

      Merge details

      • Changes merged into master with 52534e24 (commits were squashed).
      • Deleted the source branch.
      • Auto-merge enabled

      Pipeline #892446823 passed

      Pipeline passed for 52534e24 on master

      Test coverage 66.63% (6.64%) from 2 jobs
      10 environments impacted.

      Activity

      Filter activity
      • Approvals
      • Assignees & reviewers
      • Comments (from bots)
      • Comments (from users)
      • Commits & branches
      • Edits
      • Labels
      • Lock status
      • Mentions
      • Merge request status
      • Tracking
    • Radamanthus Batnag
    • Eugie Limpin added 2 commits

      added 2 commits

      • c7052a52 - Use Event.for_action scope
      • 521547f3 - Refactor spec that covers User#has_possible_spam_contribution?

      Compare with previous version

    • Eugie Limpin changed the description

      changed the description

    • added database label

    • Eugie Limpin requested review from @dbiryukov

      requested review from @dbiryukov

    • Radamanthus Batnag approved this merge request

      approved this merge request

    • :wave: @radbatnag, thanks for approving this merge request.

      This is the first time the merge request is approved. To ensure full test coverage, a new pipeline will be started shortly.

      For more info, please refer to the following links:

    • A deleted user added databasereview pending label
    • requested review from @bmarjanovic

    • Dmytro Biryukov removed review request for @dbiryukov

      removed review request for @dbiryukov

    • Dmytro Biryukov approved this merge request

      approved this merge request

    • Bojan Marjanovic approved this merge request

      approved this merge request

    • Bojan Marjanovic removed review request for @bmarjanovic

      removed review request for @bmarjanovic

    • Eugie Limpin requested review from @pshutsin and removed review request for @radbatnag

      requested review from @pshutsin and removed review request for @radbatnag

    • added databaseapproved label and removed databasereview pending label

    • Pavel Shutsin resolved all threads

      resolved all threads

    • Pavel Shutsin approved this merge request

      approved this merge request

    • Pavel Shutsin removed review request for @pshutsin

      removed review request for @pshutsin

    • Pavel Shutsin enabled an automatic merge when the pipeline for a8a83d0b succeeds

      enabled an automatic merge when the pipeline for a8a83d0b succeeds

    • merged

    • Pavel Shutsin mentioned in commit 52534e24

      mentioned in commit 52534e24

    • added workflowstaging label and removed workflowcanary label

    • Cynthia "Arty" Ng mentioned in merge request !125175 (merged)

      mentioned in merge request !125175 (merged)

    • Please register or sign in to reply
      Loading