diff options
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/api/accounts_controller.rb | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/app/controllers/api/accounts_controller.rb b/app/controllers/api/accounts_controller.rb index ccbbc93ff..490c28e75 100644 --- a/app/controllers/api/accounts_controller.rb +++ b/app/controllers/api/accounts_controller.rb @@ -1,6 +1,6 @@ class Api::AccountsController < ApiController - before_action :set_account before_action :doorkeeper_authorize! + before_action :set_account respond_to :json def show @@ -20,12 +20,14 @@ class Api::AccountsController < ApiController def follow @follow = FollowService.new.(current_user.account, @account.acct) - render action: :show + set_relationship + render action: :relationship end def unfollow @unfollow = UnfollowService.new.(current_user.account, @account) - render action: :show + set_relationship + render action: :relationship end def relationships @@ -41,4 +43,10 @@ class Api::AccountsController < ApiController def set_account @account = Account.find(params[:id]) end + + def set_relationship + @following = Account.following_map([@account.id], current_user.account_id) + @followed_by = Account.followed_by_map([@account.id], current_user.account_id) + @blocking = {} + end end |