Patch #12746 ยป Add include=journals support to issues REST api.diff
app/views/issues/index.api.rsb | ||
---|---|---|
29 | 29 |
api.relation(:id => relation.id, :issue_id => relation.issue_from_id, :issue_to_id => relation.issue_to_id, :relation_type => relation.relation_type, :delay => relation.delay) |
30 | 30 |
end |
31 | 31 |
end if include_in_api_response?('relations') |
32 | ||
33 |
journals = issue.journals.includes(:user, :details).all |
|
34 |
journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, issue.project) |
|
35 | ||
36 |
api.array :journals do |
|
37 |
journals.each do |journal| |
|
38 |
api.journal :id => journal.id do |
|
39 |
api.user(:id => journal.user_id, :name => journal.user.name) unless journal.user.nil? |
|
40 |
api.notes journal.notes |
|
41 |
api.created_on journal.created_on |
|
42 |
api.array :details do |
|
43 |
journal.details.each do |detail| |
|
44 |
api.detail :property => detail.property, :name => detail.prop_key do |
|
45 |
api.old_value detail.old_value |
|
46 |
api.new_value detail.value |
|
47 |
end |
|
48 |
end |
|
49 |
end |
|
50 |
end |
|
51 |
end |
|
52 |
end if include_in_api_response?('journals') # && !journals.empty? |
|
32 | 53 |
end |
33 | 54 |
end |
34 | 55 |
end |