summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-09-21 12:42:16 +0200
committerDouwe Maan <douwe@selenight.nl>2017-09-21 12:42:25 +0200
commita3d5c82f538062ee377609116ee585d092c13c9c (patch)
tree17555d0b4f2e764ac47823406e19ba23efafa46e
parent598b1a17a0442f0038e208f1abfc1198112282f3 (diff)
downloadgitlab-ce-dm-closing-issue-urls.tar.gz
Correctly detect multiple issue URLs after 'Closes...' in MR descriptionsdm-closing-issue-urls
-rw-r--r--changelogs/unreleased/dm-closing-issue-urls.yml5
-rw-r--r--lib/gitlab/closing_issue_extractor.rb2
-rw-r--r--spec/lib/gitlab/closing_issue_extractor_spec.rb4
3 files changed, 8 insertions, 3 deletions
diff --git a/changelogs/unreleased/dm-closing-issue-urls.yml b/changelogs/unreleased/dm-closing-issue-urls.yml
new file mode 100644
index 00000000000..059e406b63d
--- /dev/null
+++ b/changelogs/unreleased/dm-closing-issue-urls.yml
@@ -0,0 +1,5 @@
+---
+title: Correctly detect multiple issue URLs after 'Closes...' in MR descriptions
+merge_request:
+author:
+type: fixed
diff --git a/lib/gitlab/closing_issue_extractor.rb b/lib/gitlab/closing_issue_extractor.rb
index 58f86abc5c4..243c1f1394d 100644
--- a/lib/gitlab/closing_issue_extractor.rb
+++ b/lib/gitlab/closing_issue_extractor.rb
@@ -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}))")
diff --git a/spec/lib/gitlab/closing_issue_extractor_spec.rb b/spec/lib/gitlab/closing_issue_extractor_spec.rb
index 15012495247..9e528392756 100644
--- a/spec/lib/gitlab/closing_issue_extractor_spec.rb
+++ b/spec/lib/gitlab/closing_issue_extractor_spec.rb
@@ -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