FIX: Load more users URL respect group param (#13485)
This commit is contained in:
parent
cfc60f41f0
commit
18de11f3a6
|
@ -74,7 +74,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).permit!
|
||||
more_params = params.slice(:period, :order, :asc, :group).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}"
|
||||
|
|
|
@ -53,6 +53,16 @@ describe DirectoryItemsController do
|
|||
expect(json['meta']['load_more_directory_items']).to include('.json')
|
||||
end
|
||||
|
||||
it "respects more_params in load_more_directory_items" do
|
||||
get '/directory_items.json', params: { period: 'all', order: "likes_given", group: group.name }
|
||||
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("order=likes_given")
|
||||
expect(json['meta']['load_more_directory_items']).to include("period=all")
|
||||
end
|
||||
|
||||
it "fails when the directory is disabled" do
|
||||
SiteSetting.enable_user_directory = false
|
||||
|
||||
|
|
Loading…
Reference in New Issue