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.

24 lines
600 B

  1. # frozen_string_literal: true
  2. class Api::V1::SuggestionsController < Api::BaseController
  3. include Authorization
  4. before_action -> { doorkeeper_authorize! :read }
  5. before_action :require_user!
  6. def index
  7. suggestions = suggestions_source.get(current_account, limit: limit_param(DEFAULT_ACCOUNTS_LIMIT))
  8. render json: suggestions.map(&:account), each_serializer: REST::AccountSerializer
  9. end
  10. def destroy
  11. suggestions_source.remove(current_account, params[:id])
  12. render_empty
  13. end
  14. private
  15. def suggestions_source
  16. AccountSuggestions::PastInteractionsSource.new
  17. end
  18. end