Skip to content

A platform for community discussion. Free, open, simple.

DEV: Validate before and bumped_before options in TopicQuery (#23451)

Ted Johanssonad58b6d60436
diff --git a/lib/topic_query.rb b/lib/topic_query.rb
index 37655e4186c..1b70edb291a 100644
--- a/lib/topic_query.rb
+++ b/lib/topic_query.rb
@@ -19,6 +19,8 @@ class TopicQuery
array_or_string = lambda { |x| Array === x || String === x }
{
+ before: zero_up_to_max_int,
+ bumped_before: zero_up_to_max_int,
max_posts: zero_up_to_max_int,
min_posts: zero_up_to_max_int,
page: zero_up_to_max_int,
diff --git a/spec/requests/list_controller_spec.rb b/spec/requests/list_controller_spec.rb
index 9db07663cd6..dae18310b1c 100644
--- a/spec/requests/list_controller_spec.rb
+++ b/spec/requests/list_controller_spec.rb
@@ -33,6 +33,12 @@ RSpec.describe ListController do
get "/latest?tags[1]=hello"
expect(response.status).to eq(400)
+
+ get "/latest?before[1]=haxx"
+ expect(response.status).to eq(400)
+
+ get "/latest?bumped_before[1]=haxx"
+ expect(response.status).to eq(400)
end
it "returns 200 for legit requests" do