Matching version-like expressions as milestone_name
s instead of milestone_iid
s
The changes also account for %2.1. being matched as milestone_name = "2.1" without the word-separating dot.
This commit is contained in:
parent
4cab66e3e2
commit
0ba116a58e
1 changed files with 8 additions and 3 deletions
|
@ -79,14 +79,19 @@ class Milestone < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.reference_pattern
|
def self.reference_pattern
|
||||||
|
# NOTE: The iid pattern only matches when all characters on the expression
|
||||||
|
# are digits, so it will match %2 but not %2.1 because that's probably a
|
||||||
|
# milestone name and we want it to be matched as such.
|
||||||
%r{
|
%r{
|
||||||
(#{Project.reference_pattern})?
|
(#{Project.reference_pattern})?
|
||||||
#{Regexp.escape(reference_prefix)}
|
#{Regexp.escape(reference_prefix)}
|
||||||
(?:
|
(?:
|
||||||
(?<milestone_iid>\d+) | # Integer-based milestone iid, or
|
(?<milestone_iid>
|
||||||
|
\d+(?!\S\w)\b # Integer-based milestone iid, or
|
||||||
|
) |
|
||||||
(?<milestone_name>
|
(?<milestone_name>
|
||||||
[A-Za-z0-9_-]+ | # String-based single-word milestone title, or
|
[^"\s]+\b | # String-based single-word milestone title, or
|
||||||
"[^"]+" # String-based multi-word milestone surrounded in quotes
|
"[^"]+" # String-based multi-word milestone surrounded in quotes
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}x
|
}x
|
||||||
|
|
Loading…
Reference in a new issue