[openstreetmap/openstreetmap-website] Add validation of report parameters (PR #7037)

Tom Hughes notifications at github.com
Sun May 3 15:21:39 UTC 2026


@tomhughes commented on this pull request.



> @@ -10,6 +10,21 @@ def test_new_missing_parameters
     assert_response :bad_request
   end
 
+  def test_new_invalid_parameters
+    target_user = create(:user)
+    session_for(target_user)
+
+    # Invalid id
+    get new_report_path(:reportable_id => target_user.id + 1, :reportable_type => "User")

Is just incrementing the user ID a safe way of guaranteeing an invalid user? I guess it probably is so long as users are created in monotonic order.

Also we should probably test the other item types?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/7037#pullrequestreview-4216465130
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/7037/review/4216465130 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260503/a64fbc8b/attachment.htm>


More information about the rails-dev mailing list