Delegate a Note's Mentionable methods to its noteable object
This commit is contained in:
parent
9bbf873e46
commit
84dab62c18
1 changed files with 1 additions and 10 deletions
|
@ -39,6 +39,7 @@ class Note < ActiveRecord::Base
|
||||||
|
|
||||||
has_many :todos, dependent: :destroy
|
has_many :todos, dependent: :destroy
|
||||||
|
|
||||||
|
delegate :gfm_reference, :local_reference, to: :noteable
|
||||||
delegate :name, to: :project, prefix: true
|
delegate :name, to: :project, prefix: true
|
||||||
delegate :name, :email, to: :author, prefix: true
|
delegate :name, :email, to: :author, prefix: true
|
||||||
|
|
||||||
|
@ -313,16 +314,6 @@ class Note < ActiveRecord::Base
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
# Mentionable override.
|
|
||||||
def gfm_reference(from_project = nil)
|
|
||||||
noteable.gfm_reference(from_project)
|
|
||||||
end
|
|
||||||
|
|
||||||
# Mentionable override.
|
|
||||||
def local_reference
|
|
||||||
noteable
|
|
||||||
end
|
|
||||||
|
|
||||||
def noteable_type_name
|
def noteable_type_name
|
||||||
noteable_type.downcase if noteable_type.present?
|
noteable_type.downcase if noteable_type.present?
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue