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.

41 lines
806 B

  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])
  15. end
  16. def follow
  17. if @account.local?
  18. @follow = current_user.account.follow!(@account)
  19. else
  20. @follow = FollowService.new.(current_user.account, @account.acct)
  21. end
  22. render action: :show
  23. end
  24. def unfollow
  25. @unfollow = UnfollowService.new.(current_user.account, @account)
  26. render action: :show
  27. end
  28. private
  29. def set_account
  30. @account = Account.find(params[:id])
  31. end
  32. end