2017-02-16 01:28:10 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-04-10 19:27:03 +00:00
|
|
|
module Admin
|
|
|
|
class ReportsController < BaseController
|
|
|
|
before_action :set_report, except: [:index]
|
|
|
|
|
|
|
|
def index
|
2017-11-11 19:23:33 +00:00
|
|
|
authorize :report, :index?
|
2017-04-14 09:10:28 +00:00
|
|
|
@reports = filtered_reports.page(params[:page])
|
2017-04-10 19:27:03 +00:00
|
|
|
end
|
|
|
|
|
2017-07-18 14:38:22 +00:00
|
|
|
def show
|
2017-11-11 19:23:33 +00:00
|
|
|
authorize @report, :show?
|
2018-04-20 00:28:48 +00:00
|
|
|
|
|
|
|
@report_note = @report.notes.new
|
2022-01-17 08:41:33 +00:00
|
|
|
@report_notes = @report.notes.includes(:account).order(id: :desc)
|
|
|
|
@action_logs = @report.history.includes(:target)
|
|
|
|
@form = Admin::StatusBatchAction.new
|
|
|
|
@statuses = @report.statuses.with_includes
|
2017-07-18 14:38:22 +00:00
|
|
|
end
|
2017-04-10 19:27:03 +00:00
|
|
|
|
Add moderation warnings (#9519)
* Add moderation warnings
Replace individual routes for disabling, silencing, and suspending
a user, as well as the report update route, with a unified account
action controller that allows you to select an action (none,
disable, silence, suspend) as well as whether it should generate an
e-mail notification with optional custom text. That notification,
with the optional custom text, is saved as a warning.
Additionally, there are warning presets you can configure to save
time when performing the above.
* Use Account#local_username_and_domain
2018-12-22 19:02:09 +00:00
|
|
|
def assign_to_self
|
2017-11-11 19:23:33 +00:00
|
|
|
authorize @report, :update?
|
Add moderation warnings (#9519)
* Add moderation warnings
Replace individual routes for disabling, silencing, and suspending
a user, as well as the report update route, with a unified account
action controller that allows you to select an action (none,
disable, silence, suspend) as well as whether it should generate an
e-mail notification with optional custom text. That notification,
with the optional custom text, is saved as a warning.
Additionally, there are warning presets you can configure to save
time when performing the above.
* Use Account#local_username_and_domain
2018-12-22 19:02:09 +00:00
|
|
|
@report.update!(assigned_account_id: current_account.id)
|
|
|
|
log_action :assigned_to_self, @report
|
|
|
|
redirect_to admin_report_path(@report)
|
2017-04-10 19:27:03 +00:00
|
|
|
end
|
|
|
|
|
Add moderation warnings (#9519)
* Add moderation warnings
Replace individual routes for disabling, silencing, and suspending
a user, as well as the report update route, with a unified account
action controller that allows you to select an action (none,
disable, silence, suspend) as well as whether it should generate an
e-mail notification with optional custom text. That notification,
with the optional custom text, is saved as a warning.
Additionally, there are warning presets you can configure to save
time when performing the above.
* Use Account#local_username_and_domain
2018-12-22 19:02:09 +00:00
|
|
|
def unassign
|
|
|
|
authorize @report, :update?
|
|
|
|
@report.update!(assigned_account_id: nil)
|
|
|
|
log_action :unassigned, @report
|
|
|
|
redirect_to admin_report_path(@report)
|
2017-04-10 19:27:03 +00:00
|
|
|
end
|
|
|
|
|
Add moderation warnings (#9519)
* Add moderation warnings
Replace individual routes for disabling, silencing, and suspending
a user, as well as the report update route, with a unified account
action controller that allows you to select an action (none,
disable, silence, suspend) as well as whether it should generate an
e-mail notification with optional custom text. That notification,
with the optional custom text, is saved as a warning.
Additionally, there are warning presets you can configure to save
time when performing the above.
* Use Account#local_username_and_domain
2018-12-22 19:02:09 +00:00
|
|
|
def reopen
|
|
|
|
authorize @report, :update?
|
|
|
|
@report.unresolve!
|
|
|
|
log_action :reopen, @report
|
|
|
|
redirect_to admin_report_path(@report)
|
2017-04-10 19:27:03 +00:00
|
|
|
end
|
|
|
|
|
Add moderation warnings (#9519)
* Add moderation warnings
Replace individual routes for disabling, silencing, and suspending
a user, as well as the report update route, with a unified account
action controller that allows you to select an action (none,
disable, silence, suspend) as well as whether it should generate an
e-mail notification with optional custom text. That notification,
with the optional custom text, is saved as a warning.
Additionally, there are warning presets you can configure to save
time when performing the above.
* Use Account#local_username_and_domain
2018-12-22 19:02:09 +00:00
|
|
|
def resolve
|
|
|
|
authorize @report, :update?
|
|
|
|
@report.resolve!(current_account)
|
|
|
|
log_action :resolve, @report
|
|
|
|
redirect_to admin_reports_path, notice: I18n.t('admin.reports.resolved_msg')
|
2017-04-14 09:10:28 +00:00
|
|
|
end
|
|
|
|
|
Add moderation warnings (#9519)
* Add moderation warnings
Replace individual routes for disabling, silencing, and suspending
a user, as well as the report update route, with a unified account
action controller that allows you to select an action (none,
disable, silence, suspend) as well as whether it should generate an
e-mail notification with optional custom text. That notification,
with the optional custom text, is saved as a warning.
Additionally, there are warning presets you can configure to save
time when performing the above.
* Use Account#local_username_and_domain
2018-12-22 19:02:09 +00:00
|
|
|
private
|
|
|
|
|
2017-04-14 09:10:28 +00:00
|
|
|
def filtered_reports
|
Add moderation warnings (#9519)
* Add moderation warnings
Replace individual routes for disabling, silencing, and suspending
a user, as well as the report update route, with a unified account
action controller that allows you to select an action (none,
disable, silence, suspend) as well as whether it should generate an
e-mail notification with optional custom text. That notification,
with the optional custom text, is saved as a warning.
Additionally, there are warning presets you can configure to save
time when performing the above.
* Use Account#local_username_and_domain
2018-12-22 19:02:09 +00:00
|
|
|
ReportFilter.new(filter_params).results.order(id: :desc).includes(:account, :target_account)
|
2017-04-14 09:10:28 +00:00
|
|
|
end
|
|
|
|
|
2017-04-18 17:36:18 +00:00
|
|
|
def filter_params
|
2020-01-20 14:55:03 +00:00
|
|
|
params.slice(*ReportFilter::KEYS).permit(*ReportFilter::KEYS)
|
2017-04-14 09:10:28 +00:00
|
|
|
end
|
2017-04-10 19:27:03 +00:00
|
|
|
|
|
|
|
def set_report
|
|
|
|
@report = Report.find(params[:id])
|
|
|
|
end
|
2017-02-16 23:42:52 +00:00
|
|
|
end
|
2017-02-16 01:28:10 +00:00
|
|
|
end
|