[openstreetmap/openstreetmap-website] Refactor the account edit/update pages (PR #3397)
Andy Allan
notifications at github.com
Wed Dec 15 13:54:33 UTC 2021
This PR refactors the account edit/update pages out into a separate "accounts" controller. This continues the process of refactoring users_controller into separate controllers, aligned with the controllers found in Devise, along with this being some foundational work for account self-deletion.
I thought long and hard about the naming for this controller, since there are various possibilities. Devise uses "registrations" as the name for the corresponding controller, but I find that a mouthful and I think that having a controller match what we want to have in the URL is more straightforward. Throughout the site we refer to this functionality as "account" and it also matches the previous method name, so I went for that. I also think this is worth moving out of the users controller since there are various actions that apply only to your own account (e.g. `accounts#edit` to change your own password) but other situations where the same action might be used on specific other users (e.g. `users#edit` for moderators to change the display name). It therefore makes some sense to have actions that don't involve the url in the username separate from those that do, again supporting the need for a split between them.
Future work planned includes adding a `accounts#view` page, so that you can e.g. see your account details before choosing to edit them, and perhaps moving the `new` and `create` actions from users controller into accounts controller depending on how tangled that stuff is with terms and so on.
You can view, comment on, or merge this pull request online at:
https://github.com/openstreetmap/openstreetmap-website/pull/3397
-- Commit Summary --
* Refactor the account edit/update pages out into a separate accounts controller
-- File Changes --
M .rubocop_todo.yml (1)
M app/abilities/ability.rb (1)
A app/controllers/accounts_controller.rb (52)
A app/controllers/concerns/user_methods.rb (47)
M app/controllers/confirmations_controller.rb (4)
M app/controllers/users_controller.rb (89)
R app/views/accounts/edit.html.erb (4)
M app/views/application/_settings_menu.html.erb (2)
M app/views/layouts/_header.html.erb (2)
M app/views/sessions/new.html.erb (2)
M app/views/site/edit.html.erb (2)
M app/views/users/show.html.erb (2)
M config/locales/en.yml (62)
M config/routes.rb (3)
A test/controllers/accounts_controller_test.rb (128)
M test/controllers/confirmations_controller_test.rb (8)
M test/controllers/users_controller_test.rb (140)
M test/integration/client_applications_test.rb (4)
-- Patch Links --
https://github.com/openstreetmap/openstreetmap-website/pull/3397.patch
https://github.com/openstreetmap/openstreetmap-website/pull/3397.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/3397
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20211215/2149b281/attachment.htm>
More information about the rails-dev
mailing list