diff options
author | Sean McGivern <sean@gitlab.com> | 2019-06-06 17:40:07 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2019-06-06 17:40:07 +0300 |
commit | c50eed5400d97c9f566b25f76eb8d0057f910a11 (patch) | |
tree | b33ae171245c45d1e269de96b4700739ec3e6ae3 | |
parent | 90ebfaafd1c150b7e5cfde2de14cfe95a27dfcc3 (diff) | |
parent | d923e9420de09354e82f006d12c39258adac70fa (diff) |
Merge branch 'fix/allow-lower-case-issue-ids' into 'master'
Allow lowercase prefix for Youtrack issue ids
Closes #62661
See merge request gitlab-org/gitlab-ce!29057
4 files changed, 17 insertions, 5 deletions
diff --git a/app/models/project_services/youtrack_service.rb b/app/models/project_services/youtrack_service.rb index 957be685aea..175c2ebf197 100644 --- a/app/models/project_services/youtrack_service.rb +++ b/app/models/project_services/youtrack_service.rb @@ -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 diff --git a/changelogs/unreleased/fix-allow-lower-case-issue-ids.yml b/changelogs/unreleased/fix-allow-lower-case-issue-ids.yml new file mode 100644 index 00000000000..46fa90ccda0 --- /dev/null +++ b/changelogs/unreleased/fix-allow-lower-case-issue-ids.yml @@ -0,0 +1,5 @@ +--- +title: Allow lowercase prefix for Youtrack issue ids +merge_request: 29057 +author: Matthias Baur +type: fixed diff --git a/doc/user/project/integrations/youtrack.md b/doc/user/project/integrations/youtrack.md index a2a468b6fe4..81c148e41fd 100644 --- a/doc/user/project/integrations/youtrack.md +++ b/doc/user/project/integrations/youtrack.md @@ -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 is followed by 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. diff --git a/spec/lib/banzai/filter/external_issue_reference_filter_spec.rb b/spec/lib/banzai/filter/external_issue_reference_filter_spec.rb index 43222ddb5e2..7c94cf37e32 100644 --- a/spec/lib/banzai/filter/external_issue_reference_filter_spec.rb +++ b/spec/lib/banzai/filter/external_issue_reference_filter_spec.rb @@ -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 |