Retrospring/app/controllers/moderation/reports_controller.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
648 B
Ruby
Raw Normal View History

2022-08-20 12:22:20 -07:00
# frozen_string_literal: true
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])
@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?
respond_to do |format|
format.html
format.turbo_stream { render "index", layout: false, status: :see_other }
end
end
private
2024-01-24 13:45:25 -08:00
def filter_params
params.slice(*ReportFilter::KEYS).permit(*ReportFilter::KEYS)
end
end