FIX: Respond to user search correctly when category_id is blank

Previously it would search for category_id=0, which does not exist. With the new permission checks, this returns a 404
This commit is contained in:
David Taylor
2019-10-28 13:18:47 +00:00
parent f0617f96ed
commit 6de49b88df
2 changed files with 10 additions and 2 deletions

View File

@@ -3103,6 +3103,15 @@ describe UsersController do
expect(json["users"].map { |u| u["username"] }).to include(privileged_user.username)
end
it "interprets blank category id correctly" do
pm_topic = Fabricate(:private_message_post).topic
sign_in(pm_topic.user)
get "/u/search/users.json", params: {
term: "", topic_id: pm_topic.id, category_id: ""
}
expect(response.status).to eq(200)
end
context "when `enable_names` is true" do
before do
SiteSetting.enable_names = true