[openstreetmap/openstreetmap-website] [Discussion] Refactors from RFG 2018 (#1918)

Benjamin Reynolds notifications at github.com
Fri Jun 29 14:58:19 UTC 2018


This PR contains all of our larger refactor efforts from Ruby for Good 2018. Just oppening this PR to discuss some of the changes. Anything that individually looks good to merge as is we can cheery pick onto master. 

Highlights indclude...

1. Renaming some `view` controller actions to the more Rails standard `show`
2. Rubocop fixes
3. Renaming `UserController` to more standard naming of `UsersController` 
4. Various other flattening of routes and steps toward a more resourceful routing strategy.

Ill answer as many questions about these changes as I can, but feel free to also ping the original authors.
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * Guard against undefined CSP_ENFORCE constant
  * Update .rubocop_todo.yml
  * Merge pull request #1 from rubyforgood/rubocop/auto_gen_config
  * Resolve 34 Rubocop Lint/AmbiguousOperator conflicts
  * Resolve 96 Rubocop Lint/AmbiguousRegexpLiteral conflicts
  * Resolve 2 Rubocop Lint/ShadowingOuterLocalVariable conflicts
  * Merge pull request #2 from rubyforgood/rubocop/lint_ambiguous_operator
  * Merge pull request #4 from rubyforgood/rubocop/lint_shadowing_out_local_variable
  * Merge branch 'master' into rubocop/lint_ambiguous_regex_literal
  * Merge pull request #3 from rubyforgood/rubocop/lint_ambiguous_regex_literal
  * Resolved 32 Rubocop/Lint/AssignmentInConditional
  * Bring up to date with current master
  * Update rubocop todo
  * Refactor where possible.
  * Update rubocop_todo.yml
  * A bit more refactoring.
  * change user#view to user#show
  * Merge pull request #5 from rubyforgood/rubucop_assignmentincondition
  * missed notifier model
  * Resolve if unless modifier offenses.
  * Resolve 5 Rubocop Style/RedundantBegin conflicts
  * Fix errant end of input
  * Merge branch 'master' into rubocop/style_redundant_begin
  * Fix error
  * Namespace api controller
  * Merge pull request #9 from rubyforgood/rubocop/if_unless_modifier_offenses
  * Run rubocop --auto-gen-config
  * Move api_controller route actions inside the "api/0.6" scope
  * Unflatten changeset routes
  * Split changeset controller in web controller and api controller
  * Move permissions jbuilder view inside the api folder
  * Remove actions from the before filter that don't live in the controller
  * Use nested module/class definitions instead of compact style
  * Merge branch 'master' into rubocop/style_redundant_begin
  * Merge pull request #10 from rubyforgood/refactor-api-routes-changeset
  * Merge branch 'master' into rubocop/style_redundant_begin
  * Merge pull request #6 from rubyforgood/usermess
  * Resolves 25 Rubocop Style/SafeNavigation conflicts
  * Merge pull request #8 from rubyforgood/rubocop/style_redundant_begin
  * Merge branch 'master' into rubocop/style_safe_navigation
  * Re-enable cop
  * Merge pull request #11 from rubyforgood/rubocop/style_safe_navigation
  * rename usercontroller to userscontroller
  * fix changeset and remove errant view
  * Merge pull request #13 from rubyforgood/reroute
  * Clear one style/if_unless_modifier rubocop offense
  * Merge pull request #14 from rubyforgood/rubocop_style/if_unless_modifier
  * Add begins back.
  * Set rubocop ruby version to 2.3.1 and update rubocop_todo.
  * Merge pull request #15 from rubyforgood/add_begins_back_and_disable_cop_to_support_ruby2.3.1
  * move the node controller to the Api module
  * Fix tests
  * Use nested module/class definitions instead of compact style
  * Specify the controller and action to be used when generating urls in the "feature.html.erb" view
  * Resolve 20 Rubocop Style/NumericPredicate conflicts
  * Fix failing tests
  * Update Rubocop exluded file name
  * Merge pull request #17 from rubyforgood/rubocop/style_numeric_predicate
  * Merge pull request #16 from rubyforgood/refactor-api-routes-node

-- File Changes --

    M .rubocop.yml (5)
    M .rubocop_todo.yml (143)
    M app/controllers/amf_controller.rb (22)
    A app/controllers/api/api_controller.rb (314)
    A app/controllers/api/changeset_controller.rb (364)
    A app/controllers/api/node_controller.rb (77)
    D app/controllers/api_controller.rb (312)
    M app/controllers/application_controller.rb (22)
    M app/controllers/browse_controller.rb (10)
    M app/controllers/changeset_controller.rb (501)
    A app/controllers/concerns/changesetable.rb (147)
    M app/controllers/export_controller.rb (2)
    M app/controllers/geocoder_controller.rb (17)
    M app/controllers/messages_controller.rb (4)
    D app/controllers/node_controller.rb (76)
    M app/controllers/notes_controller.rb (15)
    M app/controllers/old_controller.rb (2)
    M app/controllers/traces_controller.rb (9)
    M app/controllers/user_preferences_controller.rb (3)
    R app/controllers/users_controller.rb (118)
    M app/controllers/way_controller.rb (8)
    M app/helpers/application_helper.rb (3)
    M app/helpers/banner_helper.rb (2)
    M app/helpers/browse_helper.rb (15)
    M app/helpers/changeset_helper.rb (2)
    M app/helpers/note_helper.rb (4)
    M app/helpers/notifier_helper.rb (2)
    M app/helpers/user_helper.rb (6)
    M app/helpers/user_roles_helper.rb (14)
    M app/models/changeset.rb (2)
    M app/models/client_application.rb (5)
    M app/models/notifier.rb (16)
    M app/models/relation.rb (4)
    M app/models/trace.rb (2)
    M app/models/way.rb (4)
    R app/views/api/api/permissions.builder (0)
    M app/views/browse/changeset.html.erb (14)
    M app/views/browse/feature.html.erb (2)
    M app/views/changeset/_user.atom.builder (2)
    M app/views/changeset/history.html.erb (2)
    M app/views/changeset/list.atom.builder (14)
    M app/views/diary_entry/view.html.erb (2)
    M app/views/layouts/_header.html.erb (6)
    M app/views/oauth/authorize.html.erb (2)
    R app/views/users/_auth_association.html.erb (0)
    R app/views/users/_contact.html.erb (12)
    R app/views/users/_popup.html.erb (0)
    R app/views/users/_terms.html.erb (0)
    R app/views/users/_user.html.erb (8)
    R app/views/users/account.html.erb (10)
    R app/views/users/api_read.builder (0)
    R app/views/users/blocked.html.erb (0)
    R app/views/users/confirm.html.erb (0)
    R app/views/users/confirm_email.html.erb (0)
    R app/views/users/list.html.erb (0)
    R app/views/users/login.html.erb (4)
    R app/views/users/logout.html.erb (0)
    R app/views/users/lost_password.html.erb (0)
    R app/views/users/make_friend.html.erb (0)
    R app/views/users/new.html.erb (0)
    R app/views/users/no_such_user.html.erb (0)
    R app/views/users/remove_friend.html.erb (0)
    R app/views/users/reset_password.html.erb (0)
    R app/views/users/show.html.erb (4)
    R app/views/users/suspended.html.erb (0)
    R app/views/users/terms.html.erb (0)
    M config/initializers/secure_headers.rb (32)
    M config/locales/af.yml (4)
    M config/locales/aln.yml (4)
    M config/locales/ar.yml (4)
    M config/locales/arz.yml (4)
    M config/locales/ast.yml (4)
    M config/locales/az.yml (4)
    M config/locales/be-Tarask.yml (4)
    M config/locales/be.yml (6)
    M config/locales/bg.yml (4)
    M config/locales/bn.yml (4)
    M config/locales/br.yml (4)
    M config/locales/bs.yml (4)
    M config/locales/ca.yml (4)
    M config/locales/cs.yml (4)
    M config/locales/cy.yml (4)
    M config/locales/da.yml (4)
    M config/locales/de.yml (4)
    M config/locales/diq.yml (4)
    M config/locales/dsb.yml (4)
    M config/locales/el.yml (4)
    M config/locales/en-GB.yml (4)
    M config/locales/en.yml (4)
    M config/locales/eo.yml (4)
    M config/locales/es.yml (4)
    M config/locales/et.yml (4)
    M config/locales/eu.yml (4)
    M config/locales/fa.yml (4)
    M config/locales/fi.yml (4)
    M config/locales/fr.yml (4)
    M config/locales/fur.yml (4)
    M config/locales/fy.yml (4)
    M config/locales/ga.yml (4)
    M config/locales/gcf.yml (4)
    M config/locales/gd.yml (4)
    M config/locales/gl.yml (4)
    M config/locales/he.yml (4)
    M config/locales/hi.yml (2)
    M config/locales/hr.yml (4)
    M config/locales/hsb.yml (4)
    M config/locales/hu.yml (4)
    M config/locales/ia.yml (4)
    M config/locales/id.yml (4)
    M config/locales/is.yml (4)
    M config/locales/it.yml (4)
    M config/locales/ja.yml (4)
    M config/locales/ka.yml (4)
    M config/locales/kab.yml (4)
    M config/locales/km.yml (2)
    M config/locales/kn.yml (2)
    M config/locales/ko.yml (4)
    M config/locales/ksh.yml (2)
    M config/locales/ku-Latn.yml (4)
    M config/locales/lb.yml (4)
    M config/locales/lt.yml (4)
    M config/locales/lv.yml (4)
    M config/locales/mk.yml (4)
    M config/locales/mr.yml (4)
    M config/locales/ms.yml (4)
    M config/locales/nb.yml (4)
    M config/locales/nds.yml (4)
    M config/locales/ne.yml (4)
    M config/locales/nl.yml (4)
    M config/locales/nn.yml (4)
    M config/locales/oc.yml (4)
    M config/locales/pa.yml (4)
    M config/locales/pl.yml (4)
    M config/locales/ps.yml (2)
    M config/locales/pt-BR.yml (4)
    M config/locales/pt-PT.yml (4)
    M config/locales/pt.yml (4)
    M config/locales/ro.yml (2)
    M config/locales/ru.yml (4)
    M config/locales/scn.yml (4)
    M config/locales/sco.yml (2)
    M config/locales/sk.yml (4)
    M config/locales/sl.yml (4)
    M config/locales/sq.yml (4)
    M config/locales/sr-Latn.yml (4)
    M config/locales/sr.yml (4)
    M config/locales/sv.yml (4)
    M config/locales/ta.yml (4)
    M config/locales/te.yml (4)
    M config/locales/th.yml (4)
    M config/locales/tl.yml (4)
    M config/locales/tr.yml (4)
    M config/locales/uk.yml (4)
    M config/locales/vi.yml (4)
    M config/locales/yi.yml (2)
    M config/locales/yo.yml (2)
    M config/locales/zh-CN.yml (4)
    M config/locales/zh-TW.yml (4)
    M config/routes.rb (128)
    M db/migrate/021_move_to_innodb.rb (2)
    M lib/classic_pagination/pagination.rb (2)
    M lib/daemons/gpx_import.rb (2)
    M lib/gpx.rb (2)
    M lib/nominatim.rb (3)
    M lib/osm.rb (5)
    M script/deliver-message (6)
    M test/controllers/amf_controller_test.rb (68)
    A test/controllers/api/api_controller_test.rb (441)
    A test/controllers/api/changeset_controller_test.rb (2186)
    A test/controllers/api/node_controller_test.rb (553)
    D test/controllers/api_controller_test.rb (436)
    M test/controllers/changeset_controller_test.rb (2279)
    M test/controllers/diary_entry_controller_test.rb (18)
    M test/controllers/export_controller_test.rb (2)
    M test/controllers/messages_controller_test.rb (6)
    D test/controllers/node_controller_test.rb (551)
    M test/controllers/old_node_controller_test.rb (14)
    M test/controllers/redactions_controller_test.rb (2)
    M test/controllers/relation_controller_test.rb (10)
    M test/controllers/site_controller_test.rb (4)
    M test/controllers/swf_controller_test.rb (6)
    M test/controllers/traces_controller_test.rb (10)
    M test/controllers/user_blocks_controller_test.rb (12)
    M test/controllers/user_roles_controller_test.rb (4)
    R test/controllers/users_controller_test.rb (156)
    M test/integration/client_applications_test.rb (6)
    M test/integration/user_changeset_comments_test.rb (2)
    M test/integration/user_creation_test.rb (62)
    M test/integration/user_diaries_test.rb (2)
    M test/integration/user_login_test.rb (168)
    M test/integration/user_roles_test.rb (8)
    M test/integration/user_terms_seen_test.rb (12)
    M test/lib/bounding_box_test.rb (4)
    M test/lib/country_test.rb (6)
    M test/models/changeset_test.rb (12)
    M test/models/message_test.rb (4)
    M test/models/node_test.rb (38)
    M test/models/old_node_test.rb (4)
    M test/models/relation_test.rb (22)
    M test/models/tracepoint_test.rb (4)
    M test/models/way_test.rb (22)

-- Patch Links --

https://github.com/openstreetmap/openstreetmap-website/pull/1918.patch
https://github.com/openstreetmap/openstreetmap-website/pull/1918.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/1918
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20180629/858a9d36/attachment-0001.html>


More information about the rails-dev mailing list