Skip to content

GitLab Next

    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Menu
    Projects Groups Snippets
  • Get a free trial
  • Sign up
  • Login
  • 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
    • Requirements
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Code review
    • Insights
    • Issue
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar

GitLab 15.0 is launching on May 22! This version brings many exciting improvements, but also removes deprecated features and introduces breaking changes that may impact your workflow. To see what is being deprecated and removed, please visit Breaking changes in 15.0 and Deprecations.

  • GitLab.org
  • GitLab FOSSGitLab FOSS
  • Merge requests
  • !7393
Project 'gitlab-org/gitlab-ce' was moved to 'gitlab-org/gitlab-foss'. Please update any links and bookmarks that may still have the old path.
Merged
Created Nov 10, 2016 by Timothy Andrew@timothyandrewContributor35 of 38 tasks completed35/38 tasks
  • Review changes

  • Download
  • Email patches
  • Plain diff

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