suggestions_controller.rb 576 B

123456789101112131415161718192021222324
  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. before_action :set_accounts
  7. def index
  8. render json: @accounts, each_serializer: REST::AccountSerializer
  9. end
  10. def destroy
  11. PotentialFriendshipTracker.remove(current_account.id, params[:id])
  12. render_empty
  13. end
  14. private
  15. def set_accounts
  16. @accounts = PotentialFriendshipTracker.get(current_account.id, limit: limit_param(DEFAULT_ACCOUNTS_LIMIT))
  17. end
  18. end