From 0e14a2f21dbfe20c980562dd47ab9878c023eac2 Mon Sep 17 00:00:00 2001 From: Oswaldo Ferreira Date: Wed, 11 Jan 2017 10:44:12 -0200 Subject: [PATCH] Add commment to Issue, Project and MergeRequest #to_reference --- app/models/issue.rb | 1 + app/models/merge_request.rb | 1 + app/models/project.rb | 1 + 3 files changed, 3 insertions(+) diff --git a/app/models/issue.rb b/app/models/issue.rb index ab7473d23c3..d8826b65fcc 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -97,6 +97,7 @@ class Issue < ActiveRecord::Base end end + # `from` argument can be a Namespace or Project. def to_reference(from = nil, full: false) reference = "#{self.class.reference_prefix}#{iid}" diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 67d4c70dc3a..082adcafcc8 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -179,6 +179,7 @@ class MergeRequest < ActiveRecord::Base work_in_progress?(title) ? title : "WIP: #{title}" end + # `from` argument can be a Namespace or Project. def to_reference(from = nil, full: false) reference = "#{self.class.reference_prefix}#{iid}" diff --git a/app/models/project.rb b/app/models/project.rb index 23b98916b2e..4396ea9ef36 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -591,6 +591,7 @@ class Project < ActiveRecord::Base end end + # `from` argument can be a Namespace or Project. def to_reference(from = nil, full: false) if full || cross_namespace_reference?(from) path_with_namespace