You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
463 B

  1. # frozen_string_literal: true
  2. class Api::V1::FollowsController < ApiController
  3. before_action -> { doorkeeper_authorize! :follow }
  4. before_action :require_user!
  5. respond_to :json
  6. def create
  7. raise ActiveRecord::RecordNotFound if params[:uri].blank?
  8. @account = FollowService.new.call(current_user.account, target_uri).try(:target_account)
  9. render action: :show
  10. end
  11. private
  12. def target_uri
  13. params[:uri].strip.gsub(/\A@/, '')
  14. end
  15. end