[openstreetmap/openstreetmap-website] Make traces feature optional via traces_disabled setting (PR #7156)

Tom Hughes notifications at github.com
Sun Jun 28 09:52:06 UTC 2026


@tomhughes commented on this pull request.

I think the various `test_show_disabled` methods in the test should probably go after the other `test_show...` methods rather than before them.

> @@ -107,13 +104,17 @@
     end
     post "/user/messages/:id" => "messages#update", :as => nil
 
-    resources :traces, :path => "gpx", :only => [:create, :show, :update, :destroy], :id => /\d+/ do
-      scope :module => :traces do
-        resource :data, :only => :show
+    constraints(->(_req) { !Settings.traces_disabled }) do

Is there actually any benefit to doing this dynamically with a `constraints` clause rather than just using a conditional block to disable the routes? Is this file read and processed before the settings are loaded or something?

Or is it just that you need this so you can disable them dynamically in the tests?

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

Message ID: <openstreetmap/openstreetmap-website/pull/7156/review/4587351660 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260628/f79b8eca/attachment.htm>


More information about the rails-dev mailing list