A platform for community discussion. Free, open, simple.
FEATURE: Allow `/filter` route to be accessible by anon users (#24359)
Alan Guo Xiang Tane5b0493b49c9
diff --git a/app/controllers/list_controller.rb b/app/controllers/list_controller.rbindex 1b9500bc019..e09b5e66cd5 100644--- a/app/controllers/list_controller.rb+++ b/app/controllers/list_controller.rb@@ -46,6 +46,7 @@ class ListController < ApplicationControllerTopTopic.periods.map { |p| :"category_top_#{p}" },TopTopic.periods.map { |p| :"category_none_top_#{p}" },:group_topics,+ :filter,].flatten# Create our filtersdiff --git a/spec/requests/list_controller_spec.rb b/spec/requests/list_controller_spec.rbindex c26586c1393..0565cd53a03 100644--- a/spec/requests/list_controller_spec.rb+++ b/spec/requests/list_controller_spec.rb@@ -1160,10 +1160,14 @@ RSpec.describe ListController do).to contain_exactly(topic.id)end- it "should respond with 403 response code for an anonymous user" do+ it "should not return topics that an anon user is not allowed to view" doget "/filter.json"- expect(response.status).to eq(403)+ expect(response.status).to eq(200)++ expect(+ response.parsed_body["topic_list"]["topics"].map { |topic| topic["id"] },+ ).to contain_exactly(topic.id)endit "should respond with 404 response code when `experimental_topics_filter` site setting has not been enabled" do