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

Ruben L. Mendoza notifications at github.com
Wed Jul 8 15:20:44 UTC 2026


@Rub21 commented on this pull request.



> @@ -18,4 +18,15 @@ def trace_icon(trace, options = {})
   def trace_picture(trace, options = {})
     trace_image(trace, :animated => true, :size => 250, **options)
   end
+
+  # Options for the visibility dropdown. Keeps an old value in the list so
+  # editing the trace does not change it by mistake.
+  def trace_visibility_options(trace)
+    visibilities = Trace::VISIBILITIES.dup
+    # If the trace still has an old visibility (private or public), add it so it stays selected.
+    visibilities.unshift(trace.visibility) if Trace.legacy_visibility?(trace.visibility)
+    visibilities.map do |visibility|
+      [t("traces.visibility.#{visibility}"), visibility]
+    end
+  end

Done, I've removed the comments and added test/helpers/trace_helper_test.rb using the test "..." form, covering both the normal and the legacy trace cases.

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

Message ID: <openstreetmap/openstreetmap-website/pull/7146/review/4655547964 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260708/44e82c2c/attachment.htm>


More information about the rails-dev mailing list