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) <noreply@anthropic.com>
This commit is contained in:
gabrieljablonski 2026-04-06 19:09:09 -03:00
parent 053e684261
commit 94c0827e50

View File

@ -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