[openstreetmap/openstreetmap-website] Simplify GPS trace visibility levels (PR #7146)
Ruben L. Mendoza
notifications at github.com
Tue Jun 30 18:25:03 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 it to a :on => :create validation in the model and removed the check from both controllers. The API still returns 400, and the web form now re-renders with the error if a legacy visibility is passed. That won't normally happen though, since the form only offers the valid visibilities.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/7146#discussion_r3501005299
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/7146/review/4603057675 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260630/7628a2f3/attachment.htm>
More information about the rails-dev
mailing list