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:
@ -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
|
||||
|
Reference in New Issue
Block a user