Skip to content

GitLab Next

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • GitLab FOSS GitLab FOSS
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 2
    • Merge requests 2
  • Requirements
    • Requirements
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Code review
    • Insights
    • Issue
    • Repository
    • Value stream
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.org
  • GitLab FOSSGitLab FOSS
  • Merge requests
  • !7393

You need to sign in or sign up before continuing.
Merged
Created Nov 10, 2016 by Timothy Andrew@timothyandrewContributor35 of 38 tasks completed35/38 tasks

Deleting a user shouldn't delete associated issues.

  • Overview 115
  • Commits 11
  • Pipelines 34
  • Changes 18

What does this MR do?

  • Deleting a user should not delete associated issues

Are there points in the code the reviewer needs to double check?

  • The User.ghost method creates a ghost user whose email/user doesn't conflict with any existing user in the system. This uses an Enumerator - it works well, but the code feels a little complicated.

  • A user's issues are deleted in one-by-one (user.issues.each(&:destroy)). We could potentially use update_all here, although that would skip all callbacks.

Tasks

  • Ideas to look into
    • Permissions for the ghost user
    • Turn off anything else for the ghost user?
    • Any other options while creating the ghost user?
  • Implementation
    • A user's issues are assigned to a ghost user when the user is deleted
    • EE pricing by user - exclude ghost user
      • Ghost user is a user with state = 'ghost' (which automatically makes the user inactive)
      • Don't allow state transitions from 'ghost' to anything else
      • Verify that the ghost user doesn't count towards the license limit
    • Turn off notifications for the ghost user
    • Performance: A user with 1000s of created issues is deleted
  • Tests
    • Added
    • Passing
  • Meta
    • CHANGELOG entry created
    • API support added
    • Branch has no merge conflicts with master
    • Squashed related commits together
    • Added screenshots
    • Check for clean merge with EE
  • Review
    • Miniboss (nick.thomas)
      • Reuse Namespace#clean_path to create the ghost user
      • Avoid race condition while creating ghost users
      • Bulk update issues (update_all)
      • Make ghost a boolean, and enforce that all ghosts are blocked
    • Endboss (rymai)
      • Write tests for Uniquify
      • Tests for database advisory locks
      • User who is continually creating issues can't be deleted
  • Final implementation
    • Don't allow deleting the ghost user (validation)
      • Backend validation
      • Hide the "Delete" button if the user doesn't have access
    • Describe the ghost user in the "Bio" section
  • Wait for merge

What are the relevant issue numbers?

  • Closes #12726 (closed)
  • Equivalent EE MR: gitlab-org/gitlab-ee!862
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: 12726-preserve-issues-after-deleting-users

Enable Gitpod?

To use Gitpod you must first enable the feature in the integrations section of your user preferences.

Cancel Enable Gitpod