diff options
author | Oswaldo Ferreira <oswluizf@gmail.com> | 2016-11-03 02:49:13 +0300 |
---|---|---|
committer | Oswaldo Ferreira <oswluizf@gmail.com> | 2016-12-03 00:18:17 +0300 |
commit | f272ee6eba37548cbd8919139d583a71ffdac8dc (patch) | |
tree | 78d1e9a5e7bcf4935e8efbe4e5e6e4b976dfc9e8 /app/models/commit_range.rb | |
parent | 3ebb815a38ba86e4133557f77b94c292c8fc2e7e (diff) |
Add shorthand support to gitlab markdown references
Diffstat (limited to 'app/models/commit_range.rb')
-rw-r--r-- | app/models/commit_range.rb | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/app/models/commit_range.rb b/app/models/commit_range.rb index ac2477fd973..d9af7f6c139 100644 --- a/app/models/commit_range.rb +++ b/app/models/commit_range.rb @@ -90,21 +90,24 @@ class CommitRange alias_method :id, :to_s def to_reference(from_project = nil) - if cross_project_reference?(from_project) - project.to_reference + self.class.reference_prefix + self.id + project_reference = project.to_reference(from_project) + + if project_reference.present? + project_reference + self.class.reference_prefix + self.id else self.id end end def reference_link_text(from_project = nil) - reference = ref_from + notation + ref_to + project_reference = project.to_reference(from_project) + reference = ref_from + notation + ref_to - if cross_project_reference?(from_project) - reference = project.to_reference + self.class.reference_prefix + reference + if project_reference.present? + project_reference + self.class.reference_prefix + reference + else + reference end - - reference end # Return a Hash of parameters for passing to a URL helper |