<p dir="auto">This came up during work on <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1081287173" data-permission-text="Title is private" data-url="https://github.com/openstreetmap/openstreetmap-website/issues/3398" data-hovercard-type="pull_request" data-hovercard-url="/openstreetmap/openstreetmap-website/pull/3398/hovercard" href="https://github.com/openstreetmap/openstreetmap-website/pull/3398">#3398</a> 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).</p>
<p dir="auto">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.</p>
<p dir="auto">If this is approved, then I'll rework <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1081287173" data-permission-text="Title is private" data-url="https://github.com/openstreetmap/openstreetmap-website/issues/3398" data-hovercard-type="pull_request" data-hovercard-url="/openstreetmap/openstreetmap-website/pull/3398/hovercard" href="https://github.com/openstreetmap/openstreetmap-website/pull/3398">#3398</a> to be based on top of this.</p>
<hr>
<h4>You can view, comment on, or merge this pull request online at:</h4>
<p> <a href='https://github.com/openstreetmap/openstreetmap-website/pull/3419'>https://github.com/openstreetmap/openstreetmap-website/pull/3419</a></p>
<h4>Commit Summary</h4>
<ul>
<li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/3419/commits/a73a5a5a54b52fb00d52468dbe0b84b00fe79562" class="commit-link">a73a5a5</a> Use a state machine for user status</li>
</ul>
<h4 style="display: inline-block">File Changes </h4> <p style="display: inline-block">(<a href="https://github.com/openstreetmap/openstreetmap-website/pull/3419/files">10 files</a>)</p>
<ul>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/3419/files#diff-961c5d7e0310073ca00d502eda2687808102441be660a654cab29645fbcea019">app/controllers/confirmations_controller.rb</a>
(2)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/3419/files#diff-e731908a3da0376adc4c661e2db98a148ef9be83a310f7abc2e157a481ca6132">app/controllers/passwords_controller.rb</a>
(2)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/3419/files#diff-cfdccd0a9d5df5a43aaad2a35d36ebbe187c52ad5fdc9846fa189d04537adb6e">app/controllers/users_controller.rb</a>
(10)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/3419/files#diff-9802ca3c9c4cf89904fd44bc114e35ebdf2c5dd3d5b645491e2b253e1afef29b">app/models/user.rb</a>
(53)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/3419/files#diff-78ff736409d758722403cce31873ba803b3fb526d37398ca21caa557b54dfd95">app/views/users/show.html.erb</a>
(30)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/3419/files#diff-01df9fbcb9fb4907831d5bf348fc535f13caf85ed834db5f3f039c2407bf97bf">test/controllers/browse_controller_test.rb</a>
(4)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/3419/files#diff-0d2e03e45f001516dac5c734d8c0cdbff7a73028598ed5d2f9f8623e52c6099e">test/controllers/confirmations_controller_test.rb</a>
(4)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/3419/files#diff-2719d3c650da3c587f727ca3c105e6bc93a7113f85717bb15983543cf4f85ae5">test/controllers/users_controller_test.rb</a>
(8)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/3419/files#diff-3cb894babbd387f02bde8eb4daf7ddb6f0a5207d0562af589dc59a5653092c04">test/factories/user.rb</a>
(23)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/3419/files#diff-91bef9fda3c55514e23a4a8edba948f68aad59b57951adcff0b11e9ea9159854">test/models/user_test.rb</a>
(4)
</li>
</ul>
<h4>Patch Links:</h4>
<ul>
<li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/3419.patch'>https://github.com/openstreetmap/openstreetmap-website/pull/3419.patch</a></li>
<li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/3419.diff'>https://github.com/openstreetmap/openstreetmap-website/pull/3419.diff</a></li>
</ul>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/3419">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLNVGS2BMVITXSJSJCTUVW7V5ANCNFSM5LZUSQPA">unsubscribe</a>.<br />Triage notifications on the go with GitHub Mobile for <a href="https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675">iOS</a> or <a href="https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub">Android</a>.
<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLPXE7MTHKJSID6S3G3UVW7V5A5CNFSM5LZUSQPKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4QM2PFFA.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/pull/3419</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/3419",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/3419",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>