docbrown/app/views/api/v0/comments/_comment.json.jbuilder
jkrsn98 dbdc6ead38
[deploy] API: add created_at datetime to comments (#9829)
* added created_at to comments in api response

* added test to ensure a date is returned for comment

* fix offenses in test

* updated docs to include addition of created_at to comment api response
2020-08-17 20:10:24 -04:00

14 lines
432 B
Ruby

json.type_of "comment"
json.id_code comment.id_code_generated
json.created_at utc_iso_timestamp(comment.created_at)
if comment.deleted?
json.body_html "<p>#{Comment::TITLE_DELETED}</p>"
json.set! :user, {}
elsif comment.hidden_by_commentable_user?
json.body_html "<p>#{Comment::TITLE_HIDDEN}</p>"
json.set! :user, {}
else
json.body_html comment.processed_html
json.partial! "api/v0/shared/user", user: comment.user
end