0
0
Fork 0

Allow @username@domain/@username in follow form, prevent duplicate accounts

created via remote look-up when domains differ but point to the same resource
This commit is contained in:
Eugen Rochko 2016-11-03 16:57:44 +01:00
parent e4671adc25
commit 3731230c6d
5 changed files with 37 additions and 22 deletions

View file

@ -5,7 +5,13 @@ class Api::V1::FollowsController < ApiController
def create
raise ActiveRecord::RecordNotFound if params[:uri].blank?
@account = FollowService.new.call(current_user.account, params[:uri].strip).try(:target_account)
@account = FollowService.new.call(current_user.account, target_uri).try(:target_account)
render action: :show
end
private
def target_uri
params[:uri].strip.gsub(/\A@/, '')
end
end