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:
parent
e4671adc25
commit
3731230c6d
5 changed files with 37 additions and 22 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue