Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
08908856
Commit
08908856
authored
Feb 10, 2020
by
Konrad Borowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid autolinking YouTrack issue numbers followed by letters
parent
9894f638
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
app/models/project_services/youtrack_service.rb
app/models/project_services/youtrack_service.rb
+2
-2
spec/models/project_services/youtrack_service_spec.rb
spec/models/project_services/youtrack_service_spec.rb
+4
-0
No files found.
app/models/project_services/youtrack_service.rb
View file @
08908856
...
@@ -6,9 +6,9 @@ class YoutrackService < IssueTrackerService
...
@@ -6,9 +6,9 @@ class YoutrackService < IssueTrackerService
# {PROJECT-KEY}-{NUMBER} Examples: YT-1, PRJ-1, gl-030
# {PROJECT-KEY}-{NUMBER} Examples: YT-1, PRJ-1, gl-030
def
self
.
reference_pattern
(
only_long:
false
)
def
self
.
reference_pattern
(
only_long:
false
)
if
only_long
if
only_long
/(?<issue>\b[A-Za-z][A-Za-z0-9_]*-\d+)/
/(?<issue>\b[A-Za-z][A-Za-z0-9_]*-\d+
\b
)/
else
else
/(?<issue>\b[A-Za-z][A-Za-z0-9_]*-\d+)|(
#{
Issue
.
reference_prefix
}
(?<issue>\d+))/
/(?<issue>\b[A-Za-z][A-Za-z0-9_]*-\d+
\b
)|(
#{
Issue
.
reference_prefix
}
(?<issue>\d+))/
end
end
end
end
...
...
spec/models/project_services/youtrack_service_spec.rb
View file @
08908856
...
@@ -37,6 +37,10 @@ describe YoutrackService do
...
@@ -37,6 +37,10 @@ describe YoutrackService do
it
'does allow project prefix on the reference'
do
it
'does allow project prefix on the reference'
do
expect
(
described_class
.
reference_pattern
.
match
(
'YT-123'
)[
:issue
]).
to
eq
(
'YT-123'
)
expect
(
described_class
.
reference_pattern
.
match
(
'YT-123'
)[
:issue
]).
to
eq
(
'YT-123'
)
end
end
it
'does not allow issue number to be followed by a letter'
do
expect
(
described_class
.
reference_pattern
.
match
(
'YT-123A'
)).
to
eq
(
nil
)
end
end
end
context
'overriding properties'
do
context
'overriding properties'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment