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
c249433d
Commit
c249433d
authored
Jan 19, 2021
by
Andy Soiron
Committed by
Jarka Košanová
Jan 19, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Consider context path in Jira issue links
parent
cd2ff96f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
7 deletions
+32
-7
ee/app/serializers/integrations/jira/issue_entity.rb
ee/app/serializers/integrations/jira/issue_entity.rb
+12
-3
ee/changelogs/unreleased/296833_consider_context_path_in_jira_issue_entity.yml
...sed/296833_consider_context_path_in_jira_issue_entity.yml
+5
-0
ee/spec/graphql/resolvers/external_issue_resolver_spec.rb
ee/spec/graphql/resolvers/external_issue_resolver_spec.rb
+3
-3
ee/spec/serializers/integrations/jira/issue_entity_spec.rb
ee/spec/serializers/integrations/jira/issue_entity_spec.rb
+12
-1
No files found.
ee/app/serializers/integrations/jira/issue_entity.rb
View file @
c249433d
...
@@ -58,7 +58,7 @@ module Integrations
...
@@ -58,7 +58,7 @@ module Integrations
end
end
expose
:web_url
do
|
jira_issue
|
expose
:web_url
do
|
jira_issue
|
"
#{
jira_issue
.
client
.
options
[
:site
]
}
browse/
#{
jira_issue
.
key
}
"
"
#{
base_web_url
(
jira_issue
)
}
/
browse/
#{
jira_issue
.
key
}
"
end
end
expose
:references
do
|
jira_issue
|
expose
:references
do
|
jira_issue
|
...
@@ -78,11 +78,20 @@ module Integrations
...
@@ -78,11 +78,20 @@ module Integrations
# accountId is only available on Jira Cloud.
# accountId is only available on Jira Cloud.
# https://community.atlassian.com/t5/Jira-Questions/How-to-find-account-id-on-jira-on-premise/qaq-p/1168652
# https://community.atlassian.com/t5/Jira-Questions/How-to-find-account-id-on-jira-on-premise/qaq-p/1168652
if
jira_issue
.
reporter
.
try
(
:accountId
)
if
jira_issue
.
reporter
.
try
(
:accountId
)
"
#{
jira_issue
.
client
.
options
[
:site
]
}
people/
#{
jira_issue
.
reporter
.
accountId
}
"
"
#{
base_web_url
(
jira_issue
)
}
/
people/
#{
jira_issue
.
reporter
.
accountId
}
"
else
else
"
#{
jira_issue
.
client
.
options
[
:site
]
}
secure/ViewProfile.jspa?name=
#{
jira_issue
.
reporter
.
name
}
"
"
#{
base_web_url
(
jira_issue
)
}
/
secure/ViewProfile.jspa?name=
#{
jira_issue
.
reporter
.
name
}
"
end
end
end
end
def
base_web_url
(
jira_issue
)
site_url
=
jira_issue
.
client
.
options
[
:site
].
delete_suffix
(
'/'
)
context_path
=
jira_issue
.
client
.
options
[
:context_path
].
to_s
.
delete_prefix
(
'/'
)
return
site_url
if
context_path
.
empty?
[
site_url
,
context_path
].
join
(
'/'
)
end
end
end
end
end
end
end
ee/changelogs/unreleased/296833_consider_context_path_in_jira_issue_entity.yml
0 → 100644
View file @
c249433d
---
title
:
Fix Jira issue list links when Jira runs on a subpath
merge_request
:
51797
author
:
type
:
fixed
ee/spec/graphql/resolvers/external_issue_resolver_spec.rb
View file @
c249433d
...
@@ -22,7 +22,7 @@ RSpec.describe Resolvers::ExternalIssueResolver do
...
@@ -22,7 +22,7 @@ RSpec.describe Resolvers::ExternalIssueResolver do
labels:
[],
labels:
[],
reporter:
double
(
displayName:
'User'
,
accountId:
'10000'
),
reporter:
double
(
displayName:
'User'
,
accountId:
'10000'
),
assignee:
nil
,
assignee:
nil
,
client:
double
(
options:
{
site:
nil
})
client:
double
(
options:
{
site:
'http://jira.com/'
})
)
)
end
end
...
@@ -37,10 +37,10 @@ RSpec.describe Resolvers::ExternalIssueResolver do
...
@@ -37,10 +37,10 @@ RSpec.describe Resolvers::ExternalIssueResolver do
'labels'
=>
[],
'labels'
=>
[],
'author'
=>
{
'author'
=>
{
'name'
=>
'User'
,
'name'
=>
'User'
,
'web_url'
=>
'people/10000'
'web_url'
=>
'
http://jira.com/
people/10000'
},
},
'assignees'
=>
[],
'assignees'
=>
[],
'web_url'
=>
'browse/GV-1'
,
'web_url'
=>
'
http://jira.com/
browse/GV-1'
,
'references'
=>
{
'references'
=>
{
'relative'
=>
'GV-1'
'relative'
=>
'GV-1'
},
},
...
...
ee/spec/serializers/integrations/jira/issue_entity_spec.rb
View file @
c249433d
...
@@ -23,11 +23,13 @@ RSpec.describe Integrations::Jira::IssueEntity do
...
@@ -23,11 +23,13 @@ RSpec.describe Integrations::Jira::IssueEntity do
assignee:
double
(
'displayName'
=>
'assignee'
),
assignee:
double
(
'displayName'
=>
'assignee'
),
project:
double
(
key:
'GL'
),
project:
double
(
key:
'GL'
),
key:
'GL-5'
,
key:
'GL-5'
,
client:
double
(
options:
{
site:
'http://jira.com/'
})
,
client:
jira_client
,
status:
double
(
name:
'To Do'
)
status:
double
(
name:
'To Do'
)
)
)
end
end
let
(
:jira_client
)
{
double
(
options:
{
site:
'http://jira.com/'
})
}
subject
{
described_class
.
new
(
jira_issue
,
project:
project
).
as_json
}
subject
{
described_class
.
new
(
jira_issue
,
project:
project
).
as_json
}
it
'returns the Jira issues attributes'
do
it
'returns the Jira issues attributes'
do
...
@@ -63,6 +65,15 @@ RSpec.describe Integrations::Jira::IssueEntity do
...
@@ -63,6 +65,15 @@ RSpec.describe Integrations::Jira::IssueEntity do
it
'returns the Jira Server profile URL'
do
it
'returns the Jira Server profile URL'
do
expect
(
subject
[
:author
]).
to
include
(
web_url:
'http://jira.com/secure/ViewProfile.jspa?name=reporter@reporter.com'
)
expect
(
subject
[
:author
]).
to
include
(
web_url:
'http://jira.com/secure/ViewProfile.jspa?name=reporter@reporter.com'
)
end
end
context
'and context_path'
do
let
(
:jira_client
)
{
double
(
options:
{
site:
'http://jira.com/'
,
context_path:
'/jira-sub-path'
})
}
it
'returns URLs including context path'
do
expect
(
subject
[
:author
]).
to
include
(
web_url:
'http://jira.com/jira-sub-path/secure/ViewProfile.jspa?name=reporter@reporter.com'
)
expect
(
subject
[
:web_url
]).
to
eq
(
'http://jira.com/jira-sub-path/browse/GL-5'
)
end
end
end
end
context
'with Jira Cloud configuration'
do
context
'with Jira Cloud configuration'
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