Remove legacy report pagination methods

This commit is contained in:
Andreas Nedbal 2024-01-24 22:46:50 +01:00 committed by Andreas Nedbal
parent 779dd245f5
commit fa81ef2ba6
2 changed files with 0 additions and 25 deletions

View File

@ -20,14 +20,4 @@ class Moderation::ReportsController < ApplicationController
def filter_params def filter_params
params.slice(*ReportFilter::KEYS).permit(*ReportFilter::KEYS) params.slice(*ReportFilter::KEYS).permit(*ReportFilter::KEYS)
end end
def list_reports(type:, last_id:, size: nil)
cursor_params = { last_id:, size: }.compact
if type == "all"
Report.cursored_reports(**cursor_params)
else
Report.cursored_reports_of_type(type, **cursor_params)
end
end
end end

View File

@ -16,19 +16,4 @@ class Report < ApplicationRecord
update(reason: [reason || "", new_reason].join("\n")) update(reason: [reason || "", new_reason].join("\n"))
end end
end end
class << self
include CursorPaginatable
define_cursor_paginator :cursored_reports, :list_reports
define_cursor_paginator :cursored_reports_of_type, :list_reports_of_type
def list_reports(options = {})
self.where(options.merge!(deleted: false)).reverse_order
end
def list_reports_of_type(type, options = {})
self.where(options.merge!(deleted: false)).where('LOWER(type) = ?', "reports::#{type}").reverse_order
end
end
end end