diff options
Diffstat (limited to 'app/models/issue.rb')
-rw-r--r-- | app/models/issue.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb index dc64888b6fc..93628b456f2 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -12,7 +12,7 @@ class Issue < ActiveRecord::Base include ThrottledTouch include IgnorableColumn - ignore_column :assignee_id, :branch_name + ignore_column :assignee_id, :branch_name, :deleted_at DueDateStruct = Struct.new(:title, :name).freeze NoDueDate = DueDateStruct.new('No Due Date', '0').freeze @@ -35,6 +35,8 @@ class Issue < ActiveRecord::Base validates :project, presence: true + alias_attribute :parent_ids, :project_id + scope :in_projects, ->(project_ids) { where(project_id: project_ids) } scope :assigned, -> { where('EXISTS (SELECT TRUE FROM issue_assignees WHERE issue_id = issues.id)') } @@ -76,7 +78,9 @@ class Issue < ActiveRecord::Base end end - acts_as_paranoid + class << self + alias_method :in_parents, :in_projects + end def self.reference_prefix '#' @@ -276,6 +280,11 @@ class Issue < ActiveRecord::Base private + def ensure_metrics + super + metrics.record! + end + # Returns `true` if the given User can read the current Issue. # # This method duplicates the same check of issue_policy.rb |