diff --git a/ee/app/serializers/integrations/jira/issue_entity.rb b/ee/app/serializers/integrations/jira/issue_entity.rb index 36a784c97ee8109dfdac4492aa780476fbd6e87e..b8b04b22859dd1aebdb4067c96762b3fa22f1612 100644 --- a/ee/app/serializers/integrations/jira/issue_entity.rb +++ b/ee/app/serializers/integrations/jira/issue_entity.rb @@ -79,6 +79,7 @@ class IssueEntity < Grape::Entity def jira_user(user) { name: user['displayName'], + username: user['name'], web_url: jira_web_url(user), avatar_url: user['avatarUrls']['48x48'] } diff --git a/ee/spec/serializers/integrations/jira/issue_detail_entity_spec.rb b/ee/spec/serializers/integrations/jira/issue_detail_entity_spec.rb index 75390449a7ae6a43d50130cc359a3ed41f4f5bf6..22fa946ffc663781298724ee5299e34fa65f5f4e 100644 --- a/ee/spec/serializers/integrations/jira/issue_detail_entity_spec.rb +++ b/ee/spec/serializers/integrations/jira/issue_detail_entity_spec.rb @@ -12,7 +12,7 @@ { 'displayName' => 'reporter', 'avatarUrls' => { '48x48' => 'http://reporter.avatar' }, - 'name' => double + 'name' => 'reporter@reporter.com' } end @@ -20,7 +20,7 @@ { 'displayName' => 'assignee', 'avatarUrls' => { '48x48' => 'http://assignee.avatar' }, - 'name' => double + 'name' => 'assignee@assignee.com' } end @@ -28,7 +28,7 @@ { 'displayName' => 'comment_author', 'avatarUrls' => { '48x48' => 'http://comment_author.avatar' }, - 'name' => double + 'name' => 'comment@author.com' } end @@ -86,11 +86,13 @@ ], author: hash_including( name: 'reporter', + username: 'reporter@reporter.com', avatar_url: 'http://reporter.avatar' ), assignees: [ hash_including( name: 'assignee', + username: 'assignee@assignee.com', avatar_url: 'http://assignee.avatar' ) ], @@ -100,6 +102,7 @@ comments: [ hash_including( name: 'comment_author', + username: 'comment@author.com', avatar_url: 'http://comment_author.avatar', note: "<p dir=\"auto\">Comment</p>", created_at: '2020-06-25T15:50:00.000+0000'.to_datetime.utc, @@ -110,12 +113,6 @@ end 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 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') diff --git a/ee/spec/serializers/integrations/jira/issue_entity_spec.rb b/ee/spec/serializers/integrations/jira/issue_entity_spec.rb index 25fcfbbfb2de12d9f7a5990f562e40ff65adb2a3..925a410a508fae917e0d15f79ffcc71b991125e4 100644 --- a/ee/spec/serializers/integrations/jira/issue_entity_spec.rb +++ b/ee/spec/serializers/integrations/jira/issue_entity_spec.rb @@ -12,7 +12,7 @@ { 'displayName' => 'reporter', 'avatarUrls' => { '48x48' => 'http://reporter.avatar' }, - 'name' => double + 'name' => 'reporter@reporter.com' } end @@ -20,7 +20,7 @@ { 'displayName' => 'assignee', 'avatarUrls' => { '48x48' => 'http://assignee.avatar' }, - 'name' => double + 'name' => 'assignee@assignee.com' } end @@ -61,11 +61,13 @@ ], author: hash_including( name: 'reporter', + username: 'reporter@reporter.com', avatar_url: 'http://reporter.avatar' ), assignees: [ hash_including( name: 'assignee', + username: 'assignee@assignee.com', avatar_url: 'http://assignee.avatar' ) ], @@ -77,11 +79,6 @@ end 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 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') @@ -130,7 +127,7 @@ end end - context 'feature flag "jira_issues_show_integration" is disabled' do + context 'when feature flag "jira_issues_show_integration" is disabled' do before do stub_feature_flags(jira_issues_show_integration: false) end