[openstreetmap/openstreetmap-website] Simplify GPS trace visibility levels (PR #7146)

Ruben L. Mendoza notifications at github.com
Tue Jul 7 18:10:01 UTC 2026


@Rub21 commented on this pull request.



> @@ -28,13 +28,8 @@ def create
       description = params[:description] || ""
       visibility = params[:visibility]
 
-      if visibility.nil?
-        visibility = if params.fetch(:public, "0").to_i.nonzero?
-                       "public"
-                     else
-                       "private"
-                     end
-      end
+      # New traces can only be trackable or identifiable.
+      return head :bad_request unless Trace.valid_visibility?(visibility)

Done!

 I moved the tests to the new values (trackable/identifiable). I kept public/private only where the test is really about old traces: editing one, keeping its value, and the visible_to scopes.

For those I added a without_validations trait to the factory, so a test can still insert a legacy trace even though new uploads reject it:

```rb
trait :without_validations do
  to_create { |instance| instance.save(:validate => false) }
end
```
I also updated test_validations to expect public/private rejected on create. It's all in the "Validate the create visibility in the model" commit.

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

Message ID: <openstreetmap/openstreetmap-website/pull/7146/review/4647756074 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260707/57cd0e75/attachment-0001.htm>


More information about the rails-dev mailing list