From 94c0827e5012c773198496404970491ca8a416d4 Mon Sep 17 00:00:00 2001 From: gabrieljablonski Date: Mon, 6 Apr 2026 19:09:09 -0300 Subject: [PATCH] feat(conversations): add per_page support to filter service Allow customizable page size for conversation filter results via per_page parameter, capped at 100. Defaults to CONVERSATION_RESULTS_PER_PAGE env var or 25. Co-Authored-By: Claude Opus 4.6 (1M context) --- app/services/conversations/filter_service.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/services/conversations/filter_service.rb b/app/services/conversations/filter_service.rb index db2892c31..d2c8bc9ec 100644 --- a/app/services/conversations/filter_service.rb +++ b/app/services/conversations/filter_service.rb @@ -47,6 +47,12 @@ class Conversations::FilterService < FilterService end def conversations - @conversations.sort_on_last_activity_at.page(current_page) + @conversations.sort_on_last_activity_at.page(current_page).per(per_page) + end + + def per_page + default = ENV.fetch('CONVERSATION_RESULTS_PER_PAGE', '25').to_i + requested = (@params[:per_page] || default).to_i + [requested, 100].min end end