[openstreetmap/openstreetmap-website] Move API controllers and methods into their own namespace (#2161)

Andy Allan notifications at github.com
Thu Feb 28 15:32:36 UTC 2019


This PR builds on https://github.com/openstreetmap/openstreetmap-website/pull/2160 and moves the other api controllers into the api namespace. It also splits up "mixed" controllers, where existing controllers have a mixture of website and api methods, into two separate controllers.

This removes a ton of `before_action ... except ...` and `before_action ... only ...` from the controllers, which is a big win for understandability and avoiding errors.

I plan in future work to refactor all the api controllers to inherit from a general ApiController, so that certain things (like before_actions) are common to all methods in all api controllers. However, I avoiding doing so here since the PR is already quite big and complex.
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * Move the capabilities call out of api_controller
  * Move the trackpoints call into its own controller (and rename to tracepoints)
  * Rename api controller test files
  * Move the permissions call out of api_controller
  * Move the changes api to its own controller
  * Move map method to its own controller
  * Move the api methods from changesets_controller into the api namespaced controller
  * Move the api methods from changeset_comments_controller into the api namespaced controller
  * Move the search controller to the api namespace
  * Move the user preferences controller into the api namespace
  * Move node/way/relation/old_* controllers into the api namespace
  * Move the user api methods into a separate controller in the api namespace
  * Move the notes api methods into a controller in the api namespace
  * Move the amf and swf controllers into the api namespace
  * Fix test file name
  * Move the api trace methods into a separate controller under the api namespace

-- File Changes --

    M .rubocop_todo.yml (5)
    M app/abilities/ability.rb (6)
    D app/controllers/amf_controller.rb (1000)
    A app/controllers/api/amf_controller.rb (1002)
    A app/controllers/api/capabilities_controller.rb (21)
    A app/controllers/api/changes_controller.rb (57)
    A app/controllers/api/changeset_comments_controller.rb (85)
    A app/controllers/api/changesets_controller.rb (422)
    A app/controllers/api/map_controller.rb (107)
    A app/controllers/api/nodes_controller.rb (83)
    A app/controllers/api/notes_controller.rb (373)
    A app/controllers/api/old_controller.rb (79)
    A app/controllers/api/old_nodes_controller.rb (13)
    A app/controllers/api/old_relations_controller.rb (13)
    A app/controllers/api/old_ways_controller.rb (13)
    A app/controllers/api/permissions_controller.rb (27)
    A app/controllers/api/relations_controller.rb (169)
    A app/controllers/api/search_controller.rb (102)
    A app/controllers/api/swf_controller.rb (219)
    A app/controllers/api/tracepoints_controller.rb (112)
    A app/controllers/api/traces_controller.rb (169)
    A app/controllers/api/user_preferences_controller.rb (90)
    A app/controllers/api/users_controller.rb (66)
    A app/controllers/api/ways_controller.rb (120)
    D app/controllers/api_controller.rb (279)
    M app/controllers/changeset_comments_controller.rb (84)
    M app/controllers/changesets_controller.rb (388)
    M app/controllers/export_controller.rb (2)
    D app/controllers/nodes_controller.rb (81)
    M app/controllers/notes_controller.rb (363)
    D app/controllers/old_controller.rb (77)
    D app/controllers/old_nodes_controller.rb (11)
    D app/controllers/old_relations_controller.rb (11)
    D app/controllers/old_ways_controller.rb (11)
    D app/controllers/relations_controller.rb (167)
    D app/controllers/search_controller.rb (100)
    D app/controllers/swf_controller.rb (217)
    M app/controllers/traces_controller.rb (92)
    D app/controllers/user_preferences_controller.rb (88)
    M app/controllers/users_controller.rb (56)
    D app/controllers/ways_controller.rb (118)
    M app/helpers/note_helper.rb (2)
    R app/views/api/capabilities/show.builder (0)
    R app/views/api/notes/_comment.html.erb (0)
    R app/views/api/notes/_description.html.erb (0)
    R app/views/api/notes/_entry.html.erb (0)
    R app/views/api/notes/_note.gpx.builder (0)
    R app/views/api/notes/_note.json.jsonify (0)
    R app/views/api/notes/_note.rss.builder (6)
    R app/views/api/notes/_note.xml.builder (0)
    R app/views/api/notes/feed.rss.builder (12)
    R app/views/api/notes/index.gpx.builder (0)
    R app/views/api/notes/index.json.jsonify (0)
    R app/views/api/notes/index.rss.builder (6)
    R app/views/api/notes/index.xml.builder (0)
    R app/views/api/notes/show.gpx.builder (0)
    R app/views/api/notes/show.json.jsonify (0)
    R app/views/api/notes/show.rss.builder (6)
    R app/views/api/notes/show.xml.builder (0)
    R app/views/api/permissions/show.builder (0)
    R app/views/api/users/_api_user.builder (0)
    R app/views/api/users/api_read.builder (0)
    R app/views/api/users/api_users.builder (0)
    M app/views/browse/changeset.html.erb (4)
    M app/views/browse/feature.html.erb (2)
    M app/views/browse/history.html.erb (2)
    M config/locales/en.yml (42)
    M config/routes.rb (178)
    D test/controllers/amf_controller_test.rb (1463)
    A test/controllers/api/amf_controller_test.rb (1465)
    A test/controllers/api/capabilities_controller_test.rb (35)
    A test/controllers/api/changes_controller_test.rb (106)
    A test/controllers/api/changeset_comments_controller_test.rb (254)
    A test/controllers/api/changesets_controller_test.rb (1963)
    A test/controllers/api/map_controller_test.rb (181)
    A test/controllers/api/nodes_controller_test.rb (552)
    A test/controllers/api/notes_controller_test.rb (1090)
    A test/controllers/api/old_nodes_controller_test.rb (430)
    A test/controllers/api/old_relations_controller_test.rb (274)
    A test/controllers/api/old_ways_controller_test.rb (320)
    A test/controllers/api/permissions_controller_test.rb (51)
    A test/controllers/api/relations_controller_test.rb (1079)
    A test/controllers/api/search_controller_test.rb (108)
    A test/controllers/api/swf_controller_test.rb (46)
    A test/controllers/api/tracepoints_controller_test.rb (146)
    A test/controllers/api/traces_controller_test.rb (357)
    A test/controllers/api/user_preferences_controller_test.rb (246)
    A test/controllers/api/users_controller_test.rb (199)
    A test/controllers/api/ways_controller_test.rb (754)
    D test/controllers/api_controller_test.rb (435)
    M test/controllers/changeset_comments_controller_test.rb (244)
    M test/controllers/changesets_controller_test.rb (0)
    M test/controllers/export_controller_test.rb (0)
    D test/controllers/nodes_controller_test.rb (0)
    M test/controllers/notes_controller_test.rb (0)
    D test/controllers/old_nodes_controller_test.rb (0)
    D test/controllers/old_relations_controller_test.rb (0)
    D test/controllers/old_ways_controller_test.rb (0)
    D test/controllers/relations_controller_test.rb (0)
    D test/controllers/search_controller_test.rb (0)
    D test/controllers/swf_controller_test.rb (0)
    M test/controllers/traces_controller_test.rb (0)
    D test/controllers/user_preferences_controller_test.rb (0)
    M test/controllers/users_controller_test.rb (0)
    D test/controllers/ways_controller_test.rb (0)

-- Patch Links --

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

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/2161
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20190228/37ab36f3/attachment-0001.html>


More information about the rails-dev mailing list