diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-03-03 10:39:18 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-03-03 10:41:11 +0100 |
commit | fa639df5c74c4f41c13e1bbdb897a968b6129621 (patch) | |
tree | d11672cc94a3646335c1c0736f4ad9caa38e2032 /app/models/label.rb | |
parent | 34769efa790ca39718c6ab218e8018a501f861ab (diff) | |
download | gitlab-ce-fa639df5c74c4f41c13e1bbdb897a968b6129621.tar.gz |
Remove redundant code in cross project labels implementation
Diffstat (limited to 'app/models/label.rb')
-rw-r--r-- | app/models/label.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/app/models/label.rb b/app/models/label.rb index f8817d9dc54..5ff644b8426 100644 --- a/app/models/label.rb +++ b/app/models/label.rb @@ -85,7 +85,8 @@ class Label < ActiveRecord::Base # Returns a String # def to_reference(from_project = nil, format: :id) - reference = label_format_reference(format) + format_reference = label_format_reference(format) + reference = "#{self.class.reference_prefix}#{format_reference}" if cross_project_reference?(from_project) project.to_reference + reference @@ -116,9 +117,9 @@ class Label < ActiveRecord::Base raise StandardError, 'Unknown format' unless [:id, :name].include?(format) if format == :name && !name.include?('"') - %(#{self.class.reference_prefix}"#{name}") + %("#{name}") else - "#{self.class.reference_prefix}#{id}" + id end end end |