diff --git a/app/controllers/ai_tags_controller.rb b/app/controllers/ai_tags_controller.rb index b29c0460c..15e4c7b68 100644 --- a/app/controllers/ai_tags_controller.rb +++ b/app/controllers/ai_tags_controller.rb @@ -4,12 +4,13 @@ class AITagsController < ApplicationController respond_to :js, :html, :json, :xml def index - @ai_tags = authorize AITag.visible(CurrentUser.user).paginated_search(params, count_pages: false) - @ai_tags = @ai_tags.includes(:media_asset, :tag, :post) if request.format.html? - + limit = params[:limit].presence || CurrentUser.user.per_page @mode = params.fetch(:mode, "gallery") @preview_size = params[:size].presence || cookies[:post_preview_size].presence || MediaAssetGalleryComponent::DEFAULT_SIZE + @ai_tags = authorize AITag.visible(CurrentUser.user).paginated_search(params, limit: limit, count_pages: false) + @ai_tags = @ai_tags.includes(:media_asset, :tag, :post) if request.format.html? + respond_with(@ai_tags) end