about summary refs log tree commit diff
path: root/app/controllers/admin/reports_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/admin/reports_controller.rb')
-rw-r--r--app/controllers/admin/reports_controller.rb30
1 files changed, 29 insertions, 1 deletions
diff --git a/app/controllers/admin/reports_controller.rb b/app/controllers/admin/reports_controller.rb
index 3eb5ab517..67d57e4eb 100644
--- a/app/controllers/admin/reports_controller.rb
+++ b/app/controllers/admin/reports_controller.rb
@@ -2,6 +2,7 @@
 
 class Admin::ReportsController < ApplicationController
   before_action :require_admin!
+  before_action :set_report, except: [:index]
 
   layout 'admin'
 
@@ -11,7 +12,34 @@ class Admin::ReportsController < ApplicationController
   end
 
   def show
-    @report   = Report.find(params[:id])
     @statuses = Status.where(id: @report.status_ids)
   end
+
+  def resolve
+    @report.update(action_taken: true)
+    redirect_to admin_report_path(@report)
+  end
+
+  def suspend
+    Admin::SuspensionWorker.perform_async(@report.target_account.id)
+    @report.update(action_taken: true)
+    redirect_to admin_report_path(@report)
+  end
+
+  def silence
+    @report.target_account.update(silenced: true)
+    @report.update(action_taken: true)
+    redirect_to admin_report_path(@report)
+  end
+
+  def remove
+    RemovalWorker.perform_async(params[:status_id])
+    redirect_to admin_report_path(@report)
+  end
+
+  private
+
+  def set_report
+    @report = Report.find(params[:id])
+  end
 end