Remove legacy report pagination methods
This commit is contained in:
parent
779dd245f5
commit
fa81ef2ba6
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue