mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 23:36:11 +08:00
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:

committed by
GitHub

parent
e022a7adec
commit
66c50547b4
@ -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
|
||||
|
Reference in New Issue
Block a user