summaryrefslogtreecommitdiff
path: root/app/models/user.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-01-18 17:13:28 -0600
committerDouwe Maan <douwe@selenight.nl>2017-02-06 13:45:41 -0600
commit08d4f0d654c757a4dc3018bf05959295beac882c (patch)
treeda1c5302b60c3d6b8a06fc766d2b4cbe97186012 /app/models/user.rb
parentd147688af4adb6bcd6cb0f18797c70a8a451f4fa (diff)
downloadgitlab-ce-08d4f0d654c757a4dc3018bf05959295beac882c.tar.gz
Don't delete assigned MRs/issues when user is deleted
Diffstat (limited to 'app/models/user.rb')
-rw-r--r--app/models/user.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 54f5388eb2c..6c98224de35 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -83,8 +83,6 @@ class User < ActiveRecord::Base
has_many :events, dependent: :destroy, foreign_key: :author_id
has_many :subscriptions, dependent: :destroy
has_many :recent_events, -> { order "id DESC" }, foreign_key: :author_id, class_name: "Event"
- has_many :assigned_issues, dependent: :destroy, foreign_key: :assignee_id, class_name: "Issue"
- has_many :assigned_merge_requests, dependent: :destroy, foreign_key: :assignee_id, class_name: "MergeRequest"
has_many :oauth_applications, class_name: 'Doorkeeper::Application', as: :owner, dependent: :destroy
has_one :abuse_report, dependent: :destroy
has_many :spam_logs, dependent: :destroy
@@ -94,6 +92,9 @@ class User < ActiveRecord::Base
has_many :notification_settings, dependent: :destroy
has_many :award_emoji, dependent: :destroy
+ has_many :assigned_issues, dependent: :nullify, foreign_key: :assignee_id, class_name: "Issue"
+ has_many :assigned_merge_requests, dependent: :nullify, foreign_key: :assignee_id, class_name: "MergeRequest"
+
#
# Validations
#