logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

search_controller.rb (566B)


  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 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