Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/issue.rb')
-rw-r--r--app/models/issue.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 9c568414ec2..47dc084d69c 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -81,7 +81,8 @@ class Issue < ApplicationRecord
has_and_belongs_to_many :self_managed_prometheus_alert_events, join_table: :issues_self_managed_prometheus_alert_events # rubocop: disable Rails/HasAndBelongsToMany
has_and_belongs_to_many :prometheus_alert_events, join_table: :issues_prometheus_alert_events # rubocop: disable Rails/HasAndBelongsToMany
has_many :prometheus_alerts, through: :prometheus_alert_events
- has_and_belongs_to_many :customer_relations_contacts, join_table: :issue_customer_relations_contacts, class_name: 'CustomerRelations::Contact' # rubocop: disable Rails/HasAndBelongsToMany
+ has_many :issue_customer_relations_contacts, class_name: 'CustomerRelations::IssueContact', inverse_of: :issue
+ has_many :customer_relations_contacts, through: :issue_customer_relations_contacts, source: :contact, class_name: 'CustomerRelations::Contact', inverse_of: :issues
accepts_nested_attributes_for :issuable_severity, update_only: true
accepts_nested_attributes_for :sentry_issue
@@ -203,6 +204,8 @@ class Issue < ApplicationRecord
before_transition closed: :opened do |issue|
issue.closed_at = nil
issue.closed_by = nil
+
+ issue.clear_closure_reason_references
end
end
@@ -378,6 +381,11 @@ class Issue < ApplicationRecord
!duplicated_to_id.nil?
end
+ def clear_closure_reason_references
+ self.moved_to_id = nil
+ self.duplicated_to_id = nil
+ end
+
def can_move?(user, to_project = nil)
if to_project
return false unless user.can?(:admin_issue, to_project)