Commit a3d5c82f authored by Douwe Maan's avatar Douwe Maan

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

parent 598b1a17
---
title: Correctly detect multiple issue URLs after 'Closes...' in MR descriptions
merge_request:
author:
type: fixed
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}))")
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment