* Modernize index test
* Hide comments body_html and user info if the comment is either deleted or hidden
* Shorten lines a bit
* Freeze repeated strings
* Document all /comments
* Document /comments/{id}
13 lines
378 B
Ruby
13 lines
378 B
Ruby
json.type_of "comment"
|
|
json.id_code comment.id_code_generated
|
|
|
|
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
|