A platform for community discussion. Free, open, simple.
add validation to exclude_category_ids
Sambc47148d35a8
diff --git a/lib/topic_query.rb b/lib/topic_query.rbindex cf1f09cf208..01952bd5991 100644--- a/lib/topic_query.rb+++ b/lib/topic_query.rb@@ -17,13 +17,14 @@ class TopicQueryInteger === x && x >= 0end- array_zero_or_more = lambda do |x|- Array === x && x.length > 0 && x.all? { |i| Integer === i && i >= 0 }+ array_int = lambda do |x|+ Array === x && x.length > 0 && x.all? { |i| Integer === i }end{max_posts: zero_or_more,min_posts: zero_or_more,+ exclude_category_ids: array_int}endenddiff --git a/spec/requests/list_controller_spec.rb b/spec/requests/list_controller_spec.rbindex 51ff5e493ca..a228061dd87 100644--- a/spec/requests/list_controller_spec.rb+++ b/spec/requests/list_controller_spec.rb@@ -22,6 +22,12 @@ RSpec.describe ListController doget "/latest?max_posts=bob"expect(response.status).to eq(400)++ get "/latest?exclude_category_ids=bob"+ expect(response.status).to eq(400)++ get "/latest?exclude_category_ids[]=bob"+ expect(response.status).to eq(400)endit "doesn't throw an error with page params as an array" do