diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/board.rb | 1 | ||||
-rw-r--r-- | app/models/concerns/issuable.rb | 4 | ||||
-rw-r--r-- | app/models/event.rb | 1 | ||||
-rw-r--r-- | app/models/milestone.rb | 1 | ||||
-rw-r--r-- | app/models/note.rb | 1 | ||||
-rw-r--r-- | app/models/todo.rb | 1 |
6 files changed, 9 insertions, 0 deletions
diff --git a/app/models/board.rb b/app/models/board.rb index 50b6ca9b70f..b5d07f1b282 100644 --- a/app/models/board.rb +++ b/app/models/board.rb @@ -19,6 +19,7 @@ class Board < ApplicationRecord def parent @parent ||= group || project end + alias_method :resource_parent, :parent def group_board? group_id.present? diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb index eefe9f00836..a998d9b7e1b 100644 --- a/app/models/concerns/issuable.rb +++ b/app/models/concerns/issuable.rb @@ -277,6 +277,10 @@ module Issuable end end + def resource_parent + project + end + def milestone_available? project_id == milestone&.project_id || project.ancestors_upto.compact.include?(milestone&.group) end diff --git a/app/models/event.rb b/app/models/event.rb index 392d7368033..52d54be39a9 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -51,6 +51,7 @@ class Event < ApplicationRecord belongs_to :author, class_name: "User" belongs_to :project + belongs_to :group belongs_to :target, -> { # If the association for "target" defines an "author" association we want to diff --git a/app/models/milestone.rb b/app/models/milestone.rb index 101e963ea29..cb87b46a31d 100644 --- a/app/models/milestone.rb +++ b/app/models/milestone.rb @@ -260,6 +260,7 @@ class Milestone < ApplicationRecord def parent group || project end + alias_method :resource_parent, :parent def group_milestone? group_id.present? diff --git a/app/models/note.rb b/app/models/note.rb index ebd13675dc9..0d024b0a25c 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -477,6 +477,7 @@ class Note < ApplicationRecord def parent project end + alias_method :resource_parent, :parent private diff --git a/app/models/todo.rb b/app/models/todo.rb index 1ec04189482..f7f30aed832 100644 --- a/app/models/todo.rb +++ b/app/models/todo.rb @@ -146,6 +146,7 @@ class Todo < ApplicationRecord def parent project end + alias_method :resource_parent, :parent def unmergeable? action == UNMERGEABLE |