Allow lowercase prefix for Youtrack issue ids

Relates to #42595.
Fixes #62661.
This commit is contained in:
Matthias Baur 2019-06-03 14:52:54 +02:00
parent 205f0d0cfe
commit e8683efea5
No known key found for this signature in database
GPG Key ID: B5FC9F20AD4618D6
3 changed files with 12 additions and 5 deletions

View File

@ -5,12 +5,12 @@ class YoutrackService < IssueTrackerService
prop_accessor :description, :project_url, :issues_url
# {PROJECT-KEY}-{NUMBER} Examples: YT-1, PRJ-1
# {PROJECT-KEY}-{NUMBER} Examples: YT-1, PRJ-1, gl-030
def self.reference_pattern(only_long: false)
if only_long
/(?<issue>\b[A-Z][A-Za-z0-9_]*-\d+)/
/(?<issue>\b[A-Za-z][A-Za-z0-9_]*-\d+)/
else
/(?<issue>\b[A-Z][A-Za-z0-9_]*-\d+)|(#{Issue.reference_prefix}(?<issue>\d+))/
/(?<issue>\b[A-Za-z][A-Za-z0-9_]*-\d+)|(#{Issue.reference_prefix}(?<issue>\d+))/
end
end

View File

@ -31,8 +31,8 @@ To disable the internal issue tracker in a project:
## Referencing YouTrack issues in GitLab
Issues in YouTrack can be referenced as `<PROJECT>-<ID>`. `<PROJECT>`
must start with a capital letter and can then be followed by capital or lower case
letters, numbers or underscores. `<ID>` is a number. An example reference is `YT-101` or `Api_32-143`.
must start with a letter and can then be followed by capital or lower case
letters, numbers or underscores. `<ID>` is a number. An example reference is `YT-101`, `Api_32-143` or `gl-030`.
References to `<PROJECT>-<ID>` in merge requests, commits, or comments are automatically linked to the YouTrack issue URL.
For more information, see the [External Issue Tracker](../../../integration/external-issue-tracker.md) documentation.

View File

@ -155,6 +155,13 @@ describe Banzai::Filter::ExternalIssueReferenceFilter do
it_behaves_like "external issue tracker"
end
context "with a lowercase prefix" do
let(:issue) { ExternalIssue.new("gl-030", project) }
let(:reference) { issue.to_reference }
it_behaves_like "external issue tracker"
end
end
context "jira project" do