diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-10-11 22:51:11 +0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-10-19 19:58:26 +0300 |
commit | 0e8dd599134f17e58cf533ab21cf3c4a5b50c353 (patch) | |
tree | 3d55561fe27868758ee974ab005b2e69d32916bc /app/models/project_label.rb | |
parent | 247859c82915a0ee88944c1fcda3f6faf49e54c0 (diff) |
Move common logic to reference group/project label to Label#to_reference
Diffstat (limited to 'app/models/project_label.rb')
-rw-r--r-- | app/models/project_label.rb | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/app/models/project_label.rb b/app/models/project_label.rb index 2fc074dc401..a246a90435d 100644 --- a/app/models/project_label.rb +++ b/app/models/project_label.rb @@ -7,28 +7,8 @@ class ProjectLabel < Label delegate :group, to: :project, allow_nil: true - ## - # Returns the String necessary to reference this ProjectLabel in Markdown - # - # format - Symbol format to use (default: :id, optional: :name) - # - # Examples: - # - # ProjectLabel.first.to_reference # => "~1" - # ProjectLabel.first.to_reference(format: :name) # => "~\"bug\"" - # ProjectLabel.first.to_reference(project) # => "gitlab-org/gitlab-ce~1" - # - # Returns a String - # - def to_reference(from_project = nil, format: :id) - format_reference = label_format_reference(format) - reference = "#{self.class.reference_prefix}#{format_reference}" - - if cross_project_reference?(from_project) - project.to_reference + reference - else - reference - end + def to_reference(target_project = nil, format: :id) + super(project, target_project, format: format) end private |