闭社主体 forked from https://github.com/tootsuite/mastodon
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.

29 lines
536 B

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