DEV: Experimental /filter route to filter through topics (#20494)

This commit introduces an experimental `/filter` route which allows a
user to input a query string to filter through topics.

Internal Ref: /t/92833
This commit is contained in:
Alan Guo Xiang Tan
2023-03-03 09:46:21 +08:00
committed by GitHub
parent e022a7adec
commit 66c50547b4
19 changed files with 297 additions and 37 deletions

View File

@ -1084,4 +1084,23 @@ RSpec.describe ListController do
expect(parsed["topic_list"]["topics"].first["id"]).to eq(welcome_topic.id)
end
end
describe "#filter" do
it "should respond with 403 response code for an anonymous user" do
SiteSetting.experimental_topics_filter = true
get "/filter.json"
expect(response.status).to eq(403)
end
it "should respond with 404 response code when `experimental_topics_filter` site setting has not been enabled" do
SiteSetting.experimental_topics_filter = false
sign_in(user)
get "/filter.json"
expect(response.status).to eq(404)
end
end
end