diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-06-02 18:10:40 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-06-02 18:10:40 +0300 |
commit | f123b6523328cec6445b32977f913e565f3965da (patch) | |
tree | 5fc659f57f6e72b0bf9e4c5622f15c2d2bcb485c /app | |
parent | de3e1bb4ecccaf6d5dfa26140cbfc567dd998979 (diff) | |
parent | 7db09c63cc4532acea2d736f667b36c96b22007d (diff) |
Merge branch '33215-fix-hard-delete-of-users' into 'master'
Fix hard-deleting users when they have authored issues
Closes #33215
See merge request !11855
Diffstat (limited to 'app')
-rw-r--r-- | app/models/user.rb | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 32048da6c6f..e6eb9d09656 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -101,6 +101,7 @@ class User < ActiveRecord::Base has_many :snippets, dependent: :destroy, foreign_key: :author_id has_many :notes, dependent: :destroy, foreign_key: :author_id + has_many :issues, dependent: :destroy, foreign_key: :author_id has_many :merge_requests, dependent: :destroy, foreign_key: :author_id has_many :events, dependent: :destroy, foreign_key: :author_id has_many :subscriptions, dependent: :destroy @@ -120,11 +121,6 @@ class User < ActiveRecord::Base has_many :assigned_issues, class_name: "Issue", through: :issue_assignees, source: :issue has_many :assigned_merge_requests, dependent: :nullify, foreign_key: :assignee_id, class_name: "MergeRequest" - # Issues that a user owns are expected to be moved to the "ghost" user before - # the user is destroyed. If the user owns any issues during deletion, this - # should be treated as an exceptional condition. - has_many :issues, dependent: :restrict_with_exception, foreign_key: :author_id - # # Validations # |