diff options
Diffstat (limited to 'app/models/issue.rb')
-rw-r--r-- | app/models/issue.rb | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb index 2077f9bfdbb..5338e2e6678 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -476,23 +476,6 @@ class Issue < ApplicationRecord issue_assignees.pluck(:user_id) end - private - - # Ensure that the metrics association is safely created and respecting the unique constraint on issue_id - override :ensure_metrics - def ensure_metrics - if !association(:metrics).loaded? || metrics.blank? - metrics_record = Issue::Metrics.safe_find_or_create_by(issue: self) - self.metrics = metrics_record - end - - metrics.record! - end - - def record_create_action - Gitlab::UsageDataCounters::IssueActivityUniqueCounter.track_issue_created_action(author: author) - end - # Returns `true` if the given User can read the current Issue. # # This method duplicates the same check of issue_policy.rb @@ -512,6 +495,23 @@ class Issue < ApplicationRecord end end + private + + # Ensure that the metrics association is safely created and respecting the unique constraint on issue_id + override :ensure_metrics + def ensure_metrics + if !association(:metrics).loaded? || metrics.blank? + metrics_record = Issue::Metrics.safe_find_or_create_by(issue: self) + self.metrics = metrics_record + end + + metrics.record! + end + + def record_create_action + Gitlab::UsageDataCounters::IssueActivityUniqueCounter.track_issue_created_action(author: author) + end + # Returns `true` if this Issue is visible to everybody. def publicly_visible? project.public? && !confidential? && !::Gitlab::ExternalAuthorization.enabled? |