0
0
Fork 0

Fix POST /api/v1/follows error when already following (#4878)

This commit is contained in:
Eugen Rochko 2017-09-10 15:09:06 +02:00 committed by GitHub
parent 15b886a6f0
commit c450ddb613
2 changed files with 11 additions and 0 deletions

View file

@ -10,6 +10,12 @@ class Api::V1::FollowsController < Api::BaseController
raise ActiveRecord::RecordNotFound if follow_params[:uri].blank?
@account = FollowService.new.call(current_user.account, target_uri).try(:target_account)
if @account.nil?
username, domain = target_uri.split('@')
@account = Account.find_remote!(username, domain)
end
render json: @account, serializer: REST::AccountSerializer
end