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.
22 lines
710 B
22 lines
710 B
json.author do
|
|
json.partial! 'users/user', user: discuss.user
|
|
end
|
|
json.id discuss.id
|
|
json.content discuss.content
|
|
json.time time_from_now(discuss.created_at)
|
|
json.position discuss.position
|
|
json.shixun_id discuss.dis_id
|
|
json.hidden discuss.hidden
|
|
json.manage current_user.manager_of_shixun?(container)
|
|
json.reward discuss.reward
|
|
json.game_url discuss.game_url(container, current_user)
|
|
# 主贴和回复有一些不同点
|
|
if discuss.parent_id
|
|
json.can_delete discuss.can_deleted?(current_user)
|
|
else
|
|
json.praise_count discuss.praise_tread.where(praise_or_tread: 1).count
|
|
json.user_praise discuss.praise_tread.select{|pt| pt.user_id == current_user.id}.length > 0 ? true : false
|
|
end
|
|
|
|
|