about summary refs log tree commit diff
path: root/app/controllers/admin/reports_controller.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-02-17 00:42:52 +0100
committerEugen Rochko <eugen@zeonfederated.com>2017-02-17 00:42:52 +0100
commitd0f087db2df65bd4b6c4c4558ea39f14f38733c7 (patch)
tree01b92005cb0a221469a67492643480f8e461831d /app/controllers/admin/reports_controller.rb
parent9c88d1b99ea2baa5e55251dc98f10b1ee0559ee9 (diff)
Add UI to view report details, remove reported statuses, quick links to resolve/silence/suspend from report
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