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.

25 lines
584 B

  1. # frozen_string_literal: true
  2. class Api::V1::Accounts::SearchController < Api::BaseController
  3. before_action -> { doorkeeper_authorize! :read, :'read:accounts' }
  4. before_action :require_user!
  5. respond_to :json
  6. def show
  7. @accounts = account_search
  8. render json: @accounts, each_serializer: REST::AccountSerializer
  9. end
  10. private
  11. def account_search
  12. AccountSearchService.new.call(
  13. params[:q],
  14. limit_param(DEFAULT_ACCOUNTS_LIMIT),
  15. current_account,
  16. resolve: truthy_param?(:resolve),
  17. following: truthy_param?(:following)
  18. )
  19. end
  20. end