Add a `gps_traces_enabled` boolean setting (default: `true`) that can be set to 
`false` to disable the GPS traces/tracks feature entirely. When disabled, all 
trace routes return 404, nav links and user profile trace counts are hidden, 
and CanCan abilities for Trace are not granted. Motivated by OpenGeofiction, 
where GPS tracks have no meaning on a fictional world. Setting 
`gps_traces_enabled: false` in `config/settings.local.yml` is all that is 
needed to disable the feature.

### Description
Addresses #7155:
  - New setting `gps_traces_enabled` added to `config/settings.yml` with schema 
validation in `config/initializers/config.rb`
  - `ApplicationController#check_gps_traces_enabled` defined once and added as 
a `before_action` to all 9 trace controllers (web and API)
  - Nav item and user profile links guarded with `if 
Settings.gps_traces_enabled`
  - Test coverage: one `*_disabled` test per trace controller test file 
verifying 404 responses

### How has this been tested?
 - All existing tests pass unchanged. New tests verify that each trace 
controller returns 404 when `gps_traces_enabled` is `false`.
 - Confirmed the links are present, or not, based on the setting

You can view, comment on, or merge this pull request online at:

  https://github.com/openstreetmap/openstreetmap-website/pull/7156

-- Commit Summary --

  * Make GPS traces feature optional via gps_traces_enabled setting

-- File Changes --

    M app/abilities/ability.rb (4)
    M app/controllers/api/tracepoints_controller.rb (2)
    M app/controllers/api/traces/data_controller.rb (1)
    M app/controllers/api/traces_controller.rb (1)
    M app/controllers/api/users/traces_controller.rb (1)
    M app/controllers/application_controller.rb (7)
    M app/controllers/traces/data_controller.rb (1)
    M app/controllers/traces/feeds_controller.rb (1)
    M app/controllers/traces/icons_controller.rb (1)
    M app/controllers/traces/pictures_controller.rb (1)
    M app/controllers/traces_controller.rb (1)
    M app/helpers/application_helper.rb (3)
    M app/views/users/show.html.erb (4)
    M config/initializers/config.rb (1)
    M config/settings.yml (2)
    M test/controllers/api/tracepoints_controller_test.rb (7)
    M test/controllers/api/traces/data_controller_test.rb (10)
    M test/controllers/api/traces_controller_test.rb (10)
    M test/controllers/api/users/traces_controller_test.rb (10)
    M test/controllers/traces/data_controller_test.rb (9)
    M test/controllers/traces/feeds_controller_test.rb (7)
    M test/controllers/traces/icons_controller_test.rb (9)
    M test/controllers/traces/pictures_controller_test.rb (9)
    M test/controllers/traces_controller_test.rb (7)

-- Patch Links --

https://github.com/openstreetmap/openstreetmap-website/pull/7156.patch
https://github.com/openstreetmap/openstreetmap-website/pull/7156.diff

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

Message ID: <openstreetmap/openstreetmap-website/pull/[email protected]>
_______________________________________________
rails-dev mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to