Use consistent style in *Filter classes to skip pagination (#38559)

This commit is contained in:
Matt Jankowski authored and GitHub committed 2026-04-07 09:59:36 +00:00
1 parent f2f07404b5
commit 9fdc8246f2
6 files changed
+18 -6

No files matched your search

+3 -1
View File
@@ -14,6 +14,8 @@ class AccountFilter
order
).freeze
IGNORED_PARAMS = %w(page).freeze
attr_reader :params
def initialize(params)
@@ -24,7 +26,7 @@ class AccountFilter
scope = Account.includes(:account_stat, user: [:ips, :invite_request]).without_instance_actor
relevant_params.each do |key, value|
next if key.to_s == 'page'
next if IGNORED_PARAMS.include?(key.to_s)
scope.merge!(scope_for(key, value)) if value.present?
end
+3 -1
View File
@@ -82,6 +82,8 @@ class Admin::ActionLogFilter
destroy_username_block: { target_type: 'UsernameBlock', action: 'destroy' }.freeze,
}.freeze
IGNORED_PARAMS = %w(page).freeze
attr_reader :params
def initialize(params)
@@ -92,7 +94,7 @@ class Admin::ActionLogFilter
scope = latest_action_logs.includes(:target, :account)
params.each do |key, value|
next if key.to_s == 'page'
next if IGNORED_PARAMS.include?(key.to_s)
scope.merge!(scope_for(key.to_s, value.to_s.strip)) if value.present?
end
+3 -1
View File
@@ -7,6 +7,8 @@ class Admin::TagFilter
order
).freeze
IGNORED_PARAMS = %w(page).freeze
attr_reader :params
def initialize(params)
@@ -17,7 +19,7 @@ class Admin::TagFilter
scope = Tag.all
params.each do |key, value|
next if key == :page
next if IGNORED_PARAMS.include?(key.to_s)
scope.merge!(scope_for(key, value)) if value.present?
end
+3 -1
View File
@@ -6,6 +6,8 @@ class AnnouncementFilter
unpublished
).freeze
IGNORED_PARAMS = %w(page).freeze
attr_reader :params
def initialize(params)
@@ -16,7 +18,7 @@ class AnnouncementFilter
scope = Announcement.unscoped
params.each do |key, value|
next if key.to_s == 'page'
next if IGNORED_PARAMS.include?(key.to_s)
scope.merge!(scope_for(key, value.to_s.strip)) if value.present?
end
+3 -1
View File
@@ -8,6 +8,8 @@ class CustomEmojiFilter
shortcode
).freeze
IGNORED_PARAMS = %w(page).freeze
attr_reader :params
def initialize(params)
@@ -18,7 +20,7 @@ class CustomEmojiFilter
scope = CustomEmoji.alphabetic
params.each do |key, value|
next if key.to_s == 'page'
next if IGNORED_PARAMS.include?(key.to_s)
scope.merge!(scope_for(key, value)) if value.present?
end
@@ -5,6 +5,8 @@ class Trends::PreviewCardProviderFilter
status
).freeze
IGNORED_PARAMS = %w(page).freeze
attr_reader :params
def initialize(params)
@@ -15,7 +17,7 @@ class Trends::PreviewCardProviderFilter
scope = PreviewCardProvider.unscoped
params.each do |key, value|
next if key.to_s == 'page'
next if IGNORED_PARAMS.include?(key.to_s)
scope.merge!(scope_for(key, value.to_s.strip)) if value.present?
end