diff options
author | Grzegorz Bizon <grzegorz@gitlab.com> | 2017-09-20 12:55:54 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-09-20 12:55:54 +0300 |
commit | b49bd4d3bbdceb2a62ce211ac4b094d92fa3bf04 (patch) | |
tree | 752e6da1423b4b0abca12331601fa81e4ab53315 /app | |
parent | d247841b48c6ad5b3891671e30bedeb409bfad30 (diff) |
Fix rewriting issue references with group milestones
Diffstat (limited to 'app')
-rw-r--r-- | app/models/milestone.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/app/models/milestone.rb b/app/models/milestone.rb index a3070a12b7c..47e6b785c39 100644 --- a/app/models/milestone.rb +++ b/app/models/milestone.rb @@ -162,9 +162,7 @@ class Milestone < ActiveRecord::Base # Milestone.first.to_reference(cross_namespace_project) # => "gitlab-org/gitlab-ce%1" # Milestone.first.to_reference(same_namespace_project) # => "gitlab-ce%1" # - def to_reference(from_project = nil, format: :iid, full: false) - return if group_milestone? && format != :name - + def to_reference(from_project = nil, format: :name, full: false) format_reference = milestone_format_reference(format) reference = "#{self.class.reference_prefix}#{format_reference}" @@ -241,6 +239,10 @@ class Milestone < ActiveRecord::Base def milestone_format_reference(format = :iid) raise ArgumentError, 'Unknown format' unless [:iid, :name].include?(format) + if group_milestone? && format == :iid + raise ArgumentError, 'Cannot refer to a group milestone by an internal id!' + end + if format == :name && !name.include?('"') %("#{name}") else |