From d0f087db2df65bd4b6c4c4558ea39f14f38733c7 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 17 Feb 2017 00:42:52 +0100 Subject: Add UI to view report details, remove reported statuses, quick links to resolve/silence/suspend from report --- app/controllers/admin/reports_controller.rb | 30 ++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'app/controllers/admin/reports_controller.rb') 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 -- cgit