2022-08-20 12:22:20 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-08-20 12:17:08 -07:00
|
|
|
class Moderation::ReportsController < ApplicationController
|
|
|
|
before_action :authenticate_user!
|
|
|
|
|
|
|
|
def index
|
2024-01-24 13:45:25 -08:00
|
|
|
filter = ReportFilter.new(filter_params)
|
|
|
|
@reports = filter.cursored_results(last_id: params[:last_id])
|
2022-08-20 12:17:08 -07:00
|
|
|
@reports_last_id = @reports.map(&:id).min
|
2024-01-24 13:45:25 -08:00
|
|
|
@more_data_available = filter.cursored_results(last_id: @reports_last_id, size: 1).count.positive?
|
2022-08-20 12:17:08 -07:00
|
|
|
|
|
|
|
respond_to do |format|
|
|
|
|
format.html
|
2022-09-07 15:55:10 -07:00
|
|
|
format.turbo_stream { render "index", layout: false, status: :see_other }
|
2022-08-20 12:17:08 -07:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2024-01-24 13:45:25 -08:00
|
|
|
def filter_params
|
|
|
|
params.slice(*ReportFilter::KEYS).permit(*ReportFilter::KEYS)
|
|
|
|
end
|
2022-08-20 12:17:08 -07:00
|
|
|
end
|