Commit a3931850 authored by Arturo Herrero's avatar Arturo Herrero

Merge branch '324300-fix-jira-issues-comments-datetime' into 'master'

Jira Issue: Fix comments' datetime

See merge request gitlab-org/gitlab!56560
parents 9f6157d6 6237237f
......@@ -4,8 +4,7 @@ module Integrations
module Jira
class IssueDetailEntity < ::Integrations::Jira::IssueEntity
expose :description_html do |jira_issue|
Banzai::Pipeline::JiraGfmPipeline
.call(jira_issue.renderedFields['description'], project: project)[:output].to_html
jira_gfm_pipeline(jira_issue.renderedFields['description'])
end
expose :state do |jira_issue|
......@@ -17,16 +16,22 @@ module Integrations
end
expose :comments do |jira_issue|
jira_issue.renderedFields['comment']['comments'].map do |comment|
jira_issue.fields['comment']['comments'].map.with_index do |comment, index|
{
id: comment['id'],
body_html: Banzai::Pipeline::JiraGfmPipeline.call(comment['body'], project: project)[:output].to_html,
body_html: jira_gfm_pipeline(jira_issue.renderedFields['comment']['comments'][index]['body']),
created_at: comment['created'].to_datetime.utc,
updated_at: comment['updated'].to_datetime.utc,
author: jira_user(comment['author'])
}
end
end
private
def jira_gfm_pipeline(html)
Banzai::Pipeline::JiraGfmPipeline.call(html, project: project)[:output].to_html
end
end
end
end
......@@ -40,11 +40,7 @@ RSpec.describe Integrations::Jira::IssueDetailEntity do
'comment' => {
'comments' => [
{
'id' => '10022',
'author' => comment_author,
'body' => '<p>Comment</p>',
'created' => '2020-06-25T15:50:00.000+0000',
'updated' => '2020-06-25T15:51:00.000+0000'
'body' => '<p>Comment</p>'
}
]
}
......@@ -56,7 +52,18 @@ RSpec.describe Integrations::Jira::IssueDetailEntity do
labels: ['backend'],
fields: {
'reporter' => reporter,
'assignee' => assignee
'assignee' => assignee,
'comment' => {
'comments' => [
{
'id' => '10022',
'author' => comment_author,
'body' => '<p>Comment</p>',
'created' => '2020-06-25T15:50:00.000+0000',
'updated' => '2020-06-25T15:51:00.000+0000'
}
]
}
},
project: double(key: 'GL'),
key: 'GL-5',
......
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