summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2017-09-21 17:26:41 +0000
committerRobert Speicher <robert@gitlab.com>2017-09-21 17:26:41 +0000
commit6c026c36702254f66473414c2dfbd0a7244069f6 (patch)
tree731c361a5469fb1026e21fa8a58df191feb84080
parent356658805765d01e52c7bec934173ffa8aaa6ada (diff)
parenta3d5c82f538062ee377609116ee585d092c13c9c (diff)
downloadgitlab-ce-6c026c36702254f66473414c2dfbd0a7244069f6.tar.gz
Merge branch 'dm-closing-issue-urls' into 'master'
Correctly detect multiple issue URLs after 'Closes...' in MR descriptions Closes #33745 See merge request gitlab-org/gitlab-ce!14411
-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