You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/app/views/comments/_discuss.json.jbuilder

16 lines
557 B

json.author do
json.partial! 'users/user', user: discuss.user
end
json.id discuss.id
json.content content_safe(discuss.content)
json.time time_from_now(discuss.created_at)
json.hack_id discuss.dis_id
json.hidden discuss.hidden
# 主贴和回复有一些不同点
if discuss.parent_id
json.can_delete discuss.can_deleted?(current_user)
else
json.praise_count discuss.praises_count
json.user_praise discuss.praise_treads.select{|pt| pt.user_id == current_user.id}.length > 0
json.can_delete discuss.can_deleted?(current_user) && child.count == 0
end