Commit 63082f24 authored by Arturo Herrero's avatar Arturo Herrero

Jira Issue Detail page: Jira users with username

parent 035f790e
...@@ -79,6 +79,7 @@ module Integrations ...@@ -79,6 +79,7 @@ module Integrations
def jira_user(user) def jira_user(user)
{ {
name: user['displayName'], name: user['displayName'],
username: user['name'],
web_url: jira_web_url(user), web_url: jira_web_url(user),
avatar_url: user['avatarUrls']['48x48'] avatar_url: user['avatarUrls']['48x48']
} }
......
...@@ -12,7 +12,7 @@ RSpec.describe Integrations::Jira::IssueDetailEntity do ...@@ -12,7 +12,7 @@ RSpec.describe Integrations::Jira::IssueDetailEntity do
{ {
'displayName' => 'reporter', 'displayName' => 'reporter',
'avatarUrls' => { '48x48' => 'http://reporter.avatar' }, 'avatarUrls' => { '48x48' => 'http://reporter.avatar' },
'name' => double 'name' => 'reporter@reporter.com'
} }
end end
...@@ -20,7 +20,7 @@ RSpec.describe Integrations::Jira::IssueDetailEntity do ...@@ -20,7 +20,7 @@ RSpec.describe Integrations::Jira::IssueDetailEntity do
{ {
'displayName' => 'assignee', 'displayName' => 'assignee',
'avatarUrls' => { '48x48' => 'http://assignee.avatar' }, 'avatarUrls' => { '48x48' => 'http://assignee.avatar' },
'name' => double 'name' => 'assignee@assignee.com'
} }
end end
...@@ -28,7 +28,7 @@ RSpec.describe Integrations::Jira::IssueDetailEntity do ...@@ -28,7 +28,7 @@ RSpec.describe Integrations::Jira::IssueDetailEntity do
{ {
'displayName' => 'comment_author', 'displayName' => 'comment_author',
'avatarUrls' => { '48x48' => 'http://comment_author.avatar' }, 'avatarUrls' => { '48x48' => 'http://comment_author.avatar' },
'name' => double 'name' => 'comment@author.com'
} }
end end
...@@ -86,11 +86,13 @@ RSpec.describe Integrations::Jira::IssueDetailEntity do ...@@ -86,11 +86,13 @@ RSpec.describe Integrations::Jira::IssueDetailEntity do
], ],
author: hash_including( author: hash_including(
name: 'reporter', name: 'reporter',
username: 'reporter@reporter.com',
avatar_url: 'http://reporter.avatar' avatar_url: 'http://reporter.avatar'
), ),
assignees: [ assignees: [
hash_including( hash_including(
name: 'assignee', name: 'assignee',
username: 'assignee@assignee.com',
avatar_url: 'http://assignee.avatar' avatar_url: 'http://assignee.avatar'
) )
], ],
...@@ -100,6 +102,7 @@ RSpec.describe Integrations::Jira::IssueDetailEntity do ...@@ -100,6 +102,7 @@ RSpec.describe Integrations::Jira::IssueDetailEntity do
comments: [ comments: [
hash_including( hash_including(
name: 'comment_author', name: 'comment_author',
username: 'comment@author.com',
avatar_url: 'http://comment_author.avatar', avatar_url: 'http://comment_author.avatar',
note: "<p dir=\"auto\">Comment</p>", note: "<p dir=\"auto\">Comment</p>",
created_at: '2020-06-25T15:50:00.000+0000'.to_datetime.utc, created_at: '2020-06-25T15:50:00.000+0000'.to_datetime.utc,
...@@ -110,12 +113,6 @@ RSpec.describe Integrations::Jira::IssueDetailEntity do ...@@ -110,12 +113,6 @@ RSpec.describe Integrations::Jira::IssueDetailEntity do
end end
context 'with Jira Server configuration' do context 'with Jira Server configuration' do
before do
reporter['name'] = 'reporter@reporter.com'
assignee['name'] = 'assignee@assignee.com'
comment_author['name'] = 'comment@author.com'
end
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')
expect(subject[:assignees].first).to include(web_url: 'http://jira.com/secure/ViewProfile.jspa?name=assignee@assignee.com') expect(subject[:assignees].first).to include(web_url: 'http://jira.com/secure/ViewProfile.jspa?name=assignee@assignee.com')
......
...@@ -12,7 +12,7 @@ RSpec.describe Integrations::Jira::IssueEntity do ...@@ -12,7 +12,7 @@ RSpec.describe Integrations::Jira::IssueEntity do
{ {
'displayName' => 'reporter', 'displayName' => 'reporter',
'avatarUrls' => { '48x48' => 'http://reporter.avatar' }, 'avatarUrls' => { '48x48' => 'http://reporter.avatar' },
'name' => double 'name' => 'reporter@reporter.com'
} }
end end
...@@ -20,7 +20,7 @@ RSpec.describe Integrations::Jira::IssueEntity do ...@@ -20,7 +20,7 @@ RSpec.describe Integrations::Jira::IssueEntity do
{ {
'displayName' => 'assignee', 'displayName' => 'assignee',
'avatarUrls' => { '48x48' => 'http://assignee.avatar' }, 'avatarUrls' => { '48x48' => 'http://assignee.avatar' },
'name' => double 'name' => 'assignee@assignee.com'
} }
end end
...@@ -61,11 +61,13 @@ RSpec.describe Integrations::Jira::IssueEntity do ...@@ -61,11 +61,13 @@ RSpec.describe Integrations::Jira::IssueEntity do
], ],
author: hash_including( author: hash_including(
name: 'reporter', name: 'reporter',
username: 'reporter@reporter.com',
avatar_url: 'http://reporter.avatar' avatar_url: 'http://reporter.avatar'
), ),
assignees: [ assignees: [
hash_including( hash_including(
name: 'assignee', name: 'assignee',
username: 'assignee@assignee.com',
avatar_url: 'http://assignee.avatar' avatar_url: 'http://assignee.avatar'
) )
], ],
...@@ -77,11 +79,6 @@ RSpec.describe Integrations::Jira::IssueEntity do ...@@ -77,11 +79,6 @@ RSpec.describe Integrations::Jira::IssueEntity do
end end
context 'with Jira Server configuration' do context 'with Jira Server configuration' do
before do
reporter['name'] = 'reporter@reporter.com'
assignee['name'] = 'assignee@assignee.com'
end
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')
expect(subject[:assignees].first).to include(web_url: 'http://jira.com/secure/ViewProfile.jspa?name=assignee@assignee.com') expect(subject[:assignees].first).to include(web_url: 'http://jira.com/secure/ViewProfile.jspa?name=assignee@assignee.com')
......
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