Commit 6c026c36 authored by Robert Speicher's avatar Robert Speicher

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
parents 35665880 a3d5c82f
---
title: Correctly detect multiple issue URLs after 'Closes...' in MR descriptions
merge_request:
author:
type: fixed
module Gitlab module Gitlab
class ClosingIssueExtractor class ClosingIssueExtractor
ISSUE_CLOSING_REGEX = begin 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 = Gitlab.config.gitlab.issue_closing_pattern
pattern = pattern.sub('%{issue_ref}', "(?:(?:#{link_pattern})|(?:#{Issue.reference_pattern}))") pattern = pattern.sub('%{issue_ref}', "(?:(?:#{link_pattern})|(?:#{Issue.reference_pattern}))")
......
...@@ -347,10 +347,10 @@ describe Gitlab::ClosingIssueExtractor do ...@@ -347,10 +347,10 @@ describe Gitlab::ClosingIssueExtractor do
end end
it "fetches cross-project URL references" do 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)) expect(subject.closed_by_message(message))
.to match_array([issue, issue2]) .to match_array([issue, issue2, other_issue])
end end
it "ignores invalid cross-project URL references" do 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