From 2e84ebb4deae866e7201bcdcaa67cd7cbc879f56 Mon Sep 17 00:00:00 2001 From: aakashb95 Date: Tue, 14 Jul 2026 23:15:08 +0530 Subject: [PATCH] fix(captain): cap FAQ source previews --- .../api/v1/accounts/captain/faq_suggestions_controller.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/enterprise/app/controllers/api/v1/accounts/captain/faq_suggestions_controller.rb b/enterprise/app/controllers/api/v1/accounts/captain/faq_suggestions_controller.rb index 5c9c277d3..67b834d62 100644 --- a/enterprise/app/controllers/api/v1/accounts/captain/faq_suggestions_controller.rb +++ b/enterprise/app/controllers/api/v1/accounts/captain/faq_suggestions_controller.rb @@ -5,6 +5,7 @@ class Api::V1::Accounts::Captain::FaqSuggestionsController < Api::V1::Accounts:: before_action :set_suggestion, except: [:index] RESULTS_PER_PAGE = 25 + SOURCE_PREVIEW_LIMIT = 50 def index @current_page = permitted_params[:page] || 1 @@ -17,6 +18,8 @@ class Api::V1::Accounts::Captain::FaqSuggestionsController < Api::V1::Accounts:: @observations = @suggestion.observations .where(conversation_id: accessible_conversations.select(:id)) .includes(:conversation) + .order(created_at: :desc) + .limit(SOURCE_PREVIEW_LIMIT) end def update