[openstreetmap/openstreetmap-website] Use a state machine for user status (PR #3419)

Andy Allan notifications at github.com
Wed Jan 12 18:09:34 UTC 2022


This came up during work on #3398 when considering all the ways state can be changed, and there being nowhere really to document what the states means and what it means to change them (e.g. confirmed isn't related to confirming the email, difference between an admin hiding and deleting an account, etc, which are a bit unintuitive). 

That made me think about AASM since you can define the states, the transitions, and also easily restrict which transitions between states are permitted. I think this will also come in useful when we think about removing "still pending" accounts and other things like that.

If this is approved, then I'll rework #3398 to be based on top of this.
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * Use a state machine for user status

-- File Changes --

    M app/controllers/confirmations_controller.rb (2)
    M app/controllers/passwords_controller.rb (2)
    M app/controllers/users_controller.rb (10)
    M app/models/user.rb (53)
    M app/views/users/show.html.erb (30)
    M test/controllers/browse_controller_test.rb (4)
    M test/controllers/confirmations_controller_test.rb (4)
    M test/controllers/users_controller_test.rb (8)
    M test/factories/user.rb (23)
    M test/models/user_test.rb (4)

-- Patch Links --

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

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

Message ID: <openstreetmap/openstreetmap-website/pull/3419 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20220112/f5413f08/attachment.htm>


More information about the rails-dev mailing list