Correctly detect multiple issue URLs after 'Closes...' in MR descriptions

This commit is contained in:
Douwe Maan 2017-09-21 12:42:16 +02:00
parent 598b1a17a0
commit a3d5c82f53
3 changed files with 8 additions and 3 deletions

View file

@ -0,0 +1,5 @@
---
title: Correctly detect multiple issue URLs after 'Closes...' in MR descriptions
merge_request:
author:
type: fixed

View file

@ -1,7 +1,7 @@
module Gitlab
class ClosingIssueExtractor
ISSUE_CLOSING_REGEX = begin
link_pattern = URI.regexp(%w(http https))
link_pattern = Banzai::Filter::AutolinkFilter::LINK_PATTERN
pattern = Gitlab.config.gitlab.issue_closing_pattern
pattern = pattern.sub('%{issue_ref}', "(?:(?:#{link_pattern})|(?:#{Issue.reference_pattern}))")

View file

@ -347,10 +347,10 @@ describe Gitlab::ClosingIssueExtractor do
end
it "fetches cross-project URL references" do
message = "Closes #{urls.project_issue_url(issue2.project, issue2)} and #{reference}"
message = "Closes #{urls.project_issue_url(issue2.project, issue2)}, #{reference} and #{urls.project_issue_url(other_issue.project, other_issue)}"
expect(subject.closed_by_message(message))
.to match_array([issue, issue2])
.to match_array([issue, issue2, other_issue])
end
it "ignores invalid cross-project URL references" do