FIX: Include user_field_ids in pagination URL for directory items (#13569)

FIX: Include user_field_ids in pagination URL for directory items (#13569)

diff --git a/app/controllers/directory_items_controller.rb b/app/controllers/directory_items_controller.rb
index 326fffc..b0d33be 100644
--- a/app/controllers/directory_items_controller.rb
+++ b/app/controllers/directory_items_controller.rb
@@ -75,7 +75,7 @@ class DirectoryItemsController < ApplicationController
     result_count = result.count
     result = result.limit(PAGE_SIZE).offset(PAGE_SIZE * page).to_a
 
-    more_params = params.slice(:period, :order, :asc, :group).permit!
+    more_params = params.slice(:period, :order, :asc, :group, :user_field_ids).permit!
     more_params[:page] = page + 1
     load_more_uri = URI.parse(directory_items_path(more_params))
     load_more_directory_items_json = "#{load_more_uri.path}.json?#{load_more_uri.query}"
diff --git a/spec/requests/directory_items_controller_spec.rb b/spec/requests/directory_items_controller_spec.rb
index d61ef2a..1340860 100644
--- a/spec/requests/directory_items_controller_spec.rb
+++ b/spec/requests/directory_items_controller_spec.rb
@@ -54,11 +54,12 @@ describe DirectoryItemsController do
     end
 
     it "respects more_params in load_more_directory_items" do
-      get '/directory_items.json', params: { period: 'all', order: "likes_given", group: group.name }
+      get '/directory_items.json', params: { period: 'all', order: "likes_given", group: group.name, user_field_ids: "1|2" }
       expect(response.status).to eq(200)
       json = response.parsed_body
 
       expect(json['meta']['load_more_directory_items']).to include("group=#{group.name}")
+      expect(json['meta']['load_more_directory_items']).to include("user_field_ids=#{CGI.escape('1|2')}")
       expect(json['meta']['load_more_directory_items']).to include("order=likes_given")
       expect(json['meta']['load_more_directory_items']).to include("period=all")
     end

GitHub sha: 4b27de8c4b7998b87469a85309a6300d9d143c4a

This commit appears in #13569 which was approved by eviltrout. It was merged by markvanlan.