The code powering m.abunchtell.com https://m.abunchtell.com
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.
 
 
 
 

45 lines
1.0 KiB

  1. class Api::AccountsController < ApiController
  2. before_action :set_account
  3. before_action :doorkeeper_authorize!
  4. respond_to :json
  5. def show
  6. end
  7. def following
  8. @following = @account.following
  9. end
  10. def followers
  11. @followers = @account.followers
  12. end
  13. def statuses
  14. @statuses = @account.statuses.with_includes.with_counters.paginate_by_max_id(20, params[:max_id] || nil).to_a
  15. end
  16. def follow
  17. @follow = FollowService.new.(current_user.account, @account.acct)
  18. render action: :show
  19. end
  20. def unfollow
  21. @unfollow = UnfollowService.new.(current_user.account, @account)
  22. render action: :show
  23. end
  24. def relationships
  25. ids = params[:id].is_a?(Enumerable) ? params[:id].map { |id| id.to_i } : [params[:id].to_i]
  26. @accounts = Account.find(ids)
  27. @following = Account.following_map(ids, current_user.account_id)
  28. @followed_by = Account.followed_by_map(ids, current_user.account_id)
  29. @blocking = {}
  30. end
  31. private
  32. def set_account
  33. @account = Account.find(params[:id])
  34. end
  35. end