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.

28 lines
663 B

  1. # frozen_string_literal: true
  2. class Api::V1::ReportsController < Api::BaseController
  3. before_action -> { doorkeeper_authorize! :write, :'write:reports' }, only: [:create]
  4. before_action :require_user!
  5. override_rate_limit_headers :create, family: :reports
  6. def create
  7. @report = ReportService.new.call(
  8. current_account,
  9. reported_account,
  10. report_params
  11. )
  12. render json: @report, serializer: REST::ReportSerializer
  13. end
  14. private
  15. def reported_account
  16. Account.find(report_params[:account_id])
  17. end
  18. def report_params
  19. params.permit(:account_id, :comment, :category, :forward, status_ids: [], rule_ids: [])
  20. end
  21. end