From fa81ef2ba62ffadd24d36bdce1009b3b46f513ea Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Wed, 24 Jan 2024 22:46:50 +0100 Subject: [PATCH] Remove legacy report pagination methods --- app/controllers/moderation/reports_controller.rb | 10 ---------- app/models/report.rb | 15 --------------- 2 files changed, 25 deletions(-) diff --git a/app/controllers/moderation/reports_controller.rb b/app/controllers/moderation/reports_controller.rb index 758a8851..e4977217 100644 --- a/app/controllers/moderation/reports_controller.rb +++ b/app/controllers/moderation/reports_controller.rb @@ -20,14 +20,4 @@ class Moderation::ReportsController < ApplicationController def filter_params params.slice(*ReportFilter::KEYS).permit(*ReportFilter::KEYS) 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 diff --git a/app/models/report.rb b/app/models/report.rb index 3cdb28a4..b437b5c9 100644 --- a/app/models/report.rb +++ b/app/models/report.rb @@ -16,19 +16,4 @@ class Report < ApplicationRecord update(reason: [reason || "", new_reason].join("\n")) 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