闭社主体 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.

44 lines
1.3 KiB

  1. # frozen_string_literal: true
  2. module Admin
  3. class ReportsController < BaseController
  4. before_action :set_report, except: [:index]
  5. def index
  6. @reports = Report.includes(:account, :target_account).order('id desc').page(params[:page])
  7. @reports = params[:action_taken].present? ? @reports.resolved : @reports.unresolved
  8. end
  9. def show
  10. @statuses = Status.where(id: @report.status_ids)
  11. end
  12. def resolve
  13. @report.update(action_taken: true, action_taken_by_account_id: current_account.id)
  14. redirect_to admin_report_path(@report)
  15. end
  16. def suspend
  17. Admin::SuspensionWorker.perform_async(@report.target_account.id)
  18. Report.unresolved.where(target_account: @report.target_account).update_all(action_taken: true, action_taken_by_account_id: current_account.id)
  19. redirect_to admin_report_path(@report)
  20. end
  21. def silence
  22. @report.target_account.update(silenced: true)
  23. Report.unresolved.where(target_account: @report.target_account).update_all(action_taken: true, action_taken_by_account_id: current_account.id)
  24. redirect_to admin_report_path(@report)
  25. end
  26. def remove
  27. RemovalWorker.perform_async(params[:status_id])
  28. redirect_to admin_report_path(@report)
  29. end
  30. private
  31. def set_report
  32. @report = Report.find(params[:id])
  33. end
  34. end
  35. end