2018-12-05 23:21:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2015-09-11 14:41:01 +05:30
|
|
|
class Admin::AbuseReportsController < Admin::ApplicationController
|
2023-03-04 22:38:38 +05:30
|
|
|
feature_category :insider_threat
|
2021-01-03 14:25:43 +05:30
|
|
|
|
2023-05-27 22:25:52 +05:30
|
|
|
before_action :set_status_param, only: :index, if: -> { Feature.enabled?(:abuse_reports_list) }
|
2023-07-09 08:55:56 +05:30
|
|
|
before_action :find_abuse_report, only: [:show, :update, :destroy]
|
2023-05-27 22:25:52 +05:30
|
|
|
|
2015-09-11 14:41:01 +05:30
|
|
|
def index
|
2019-12-26 22:10:19 +05:30
|
|
|
@abuse_reports = AbuseReportsFinder.new(params).execute
|
2015-09-11 14:41:01 +05:30
|
|
|
end
|
|
|
|
|
2023-07-09 08:55:56 +05:30
|
|
|
def show; end
|
|
|
|
|
|
|
|
def update
|
|
|
|
Admin::AbuseReportUpdateService.new(@abuse_report, current_user, permitted_params).execute
|
|
|
|
end
|
2015-09-11 14:41:01 +05:30
|
|
|
|
2023-07-09 08:55:56 +05:30
|
|
|
def destroy
|
|
|
|
@abuse_report.remove_user(deleted_by: current_user) if params[:remove_user]
|
|
|
|
@abuse_report.destroy
|
2016-01-14 18:37:52 +05:30
|
|
|
|
2016-06-02 11:05:42 +05:30
|
|
|
head :ok
|
2015-09-11 14:41:01 +05:30
|
|
|
end
|
2023-05-27 22:25:52 +05:30
|
|
|
|
|
|
|
private
|
|
|
|
|
2023-07-09 08:55:56 +05:30
|
|
|
def find_abuse_report
|
|
|
|
@abuse_report = AbuseReport.find(params[:id])
|
|
|
|
end
|
|
|
|
|
2023-05-27 22:25:52 +05:30
|
|
|
def set_status_param
|
|
|
|
params[:status] ||= 'open'
|
|
|
|
end
|
2023-07-09 08:55:56 +05:30
|
|
|
|
|
|
|
def permitted_params
|
|
|
|
params.permit(:user_action, :close, :reason, :comment)
|
|
|
|
end
|
2015-09-11 14:41:01 +05:30
|
|
|
end
|