mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-23 19:13:13 +01:00
4ada50985a
* Replace will_paginate with kaminari * Use #page instead of #paginate in controllers * Replace will_paginate.page_gap with pagination.truncate in i18n * Customize kaminari views to match prior styles * Set kaminari options to match prior behavior * Replace will_paginate with paginate in views
44 lines
1.3 KiB
Ruby
44 lines
1.3 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
module Admin
|
|
class ReportsController < BaseController
|
|
before_action :set_report, except: [:index]
|
|
|
|
def index
|
|
@reports = Report.includes(:account, :target_account).order('id desc').page(params[:page])
|
|
@reports = params[:action_taken].present? ? @reports.resolved : @reports.unresolved
|
|
end
|
|
|
|
def show
|
|
@statuses = Status.where(id: @report.status_ids)
|
|
end
|
|
|
|
def resolve
|
|
@report.update(action_taken: true, action_taken_by_account_id: current_account.id)
|
|
redirect_to admin_report_path(@report)
|
|
end
|
|
|
|
def suspend
|
|
Admin::SuspensionWorker.perform_async(@report.target_account.id)
|
|
Report.unresolved.where(target_account: @report.target_account).update_all(action_taken: true, action_taken_by_account_id: current_account.id)
|
|
redirect_to admin_report_path(@report)
|
|
end
|
|
|
|
def silence
|
|
@report.target_account.update(silenced: true)
|
|
Report.unresolved.where(target_account: @report.target_account).update_all(action_taken: true, action_taken_by_account_id: current_account.id)
|
|
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
|
|
end
|