2016-09-27 23:58:23 +09:00
|
|
|
class Api::V1::FollowsController < ApiController
|
2016-10-23 02:38:47 +09:00
|
|
|
before_action -> { doorkeeper_authorize! :follow }
|
2016-03-07 20:42:33 +09:00
|
|
|
respond_to :json
|
|
|
|
|
|
|
|
def create
|
2016-09-30 04:28:21 +09:00
|
|
|
raise ActiveRecord::RecordNotFound if params[:uri].blank?
|
2016-09-13 02:20:55 +09:00
|
|
|
|
2016-11-04 00:57:44 +09:00
|
|
|
@account = FollowService.new.call(current_user.account, target_uri).try(:target_account)
|
2016-03-07 20:42:33 +09:00
|
|
|
render action: :show
|
|
|
|
end
|
2016-11-04 00:57:44 +09:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def target_uri
|
|
|
|
params[:uri].strip.gsub(/\A@/, '')
|
|
|
|
end
|
2016-03-07 20:42:33 +09:00
|
|
|
end
|