json.id memo.id
json.content memo.content
json.time time_from_now(memo.created_at)
json.user_id memo.author_id
json.image_url url_to_avatar(memo.author)
json.username memo.author.full_name
json.reward memo.reward
json.hidden memo.hidden
json.permission @user.manager_of_memo?(memo)
json.praise_count memo.praise_treads.select{|pt| pt.praise_or_tread == 1}.count
json.user_praise memo.praise_treads.select{|pt| pt.praise_or_tread == 1 && pt.user_id == @user.id}.length > 0
json.user_login memo.author.login
json.admin @user.admin? || @user.business?

json.children do
  json.array! memo.children_of_reply do |child|
    json.id child.id
    json.content child.content
    json.time time_from_now(child.created_at)
    json.image_url url_to_avatar(child.author)
    json.username child.author.full_name
    json.hidden child.hidden
    json.permission @user.manager_of_memo?(memo)
    json.user_login child.author.try(:login)
    json.user_id child.author.try(:id)
  end
end
