Add commment to Issue, Project and MergeRequest #to_reference

This commit is contained in:
Oswaldo Ferreira 2017-01-11 10:44:12 -02:00
parent 660a755cad
commit 0e14a2f21d
3 changed files with 3 additions and 0 deletions

View file

@ -97,6 +97,7 @@ class Issue < ActiveRecord::Base
end end
end end
# `from` argument can be a Namespace or Project.
def to_reference(from = nil, full: false) def to_reference(from = nil, full: false)
reference = "#{self.class.reference_prefix}#{iid}" reference = "#{self.class.reference_prefix}#{iid}"

View file

@ -179,6 +179,7 @@ class MergeRequest < ActiveRecord::Base
work_in_progress?(title) ? title : "WIP: #{title}" work_in_progress?(title) ? title : "WIP: #{title}"
end end
# `from` argument can be a Namespace or Project.
def to_reference(from = nil, full: false) def to_reference(from = nil, full: false)
reference = "#{self.class.reference_prefix}#{iid}" reference = "#{self.class.reference_prefix}#{iid}"

View file

@ -591,6 +591,7 @@ class Project < ActiveRecord::Base
end end
end end
# `from` argument can be a Namespace or Project.
def to_reference(from = nil, full: false) def to_reference(from = nil, full: false)
if full || cross_namespace_reference?(from) if full || cross_namespace_reference?(from)
path_with_namespace path_with_namespace