X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/1a11c4dc191d93b18fcf5aa917448c8cd6d2556b..2731e7244ac554c4a17f69347851f8f829cd1caa:/app/models/user.rb diff --git a/app/models/user.rb b/app/models/user.rb index 123ef3230..cc12adecc 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -181,10 +181,21 @@ class User < ApplicationRecord transitions :from => [:pending, :active, :suspended], :to => :confirmed end + # To unconfirm an account is to make it subject to future spam scoring again + event :unconfirm do + transitions :from => :confirmed, :to => :active + end + + # Accounts can be automatically suspended by spam_check event :suspend do transitions :from => [:pending, :active], :to => :suspended end + # Unsuspending an account moves it back to active without overriding the spam scoring + event :unsuspend do + transitions :from => :suspended, :to => :active + end + # Mark the account as deleted but keep all data intact event :hide do transitions :from => [:pending, :active, :confirmed, :suspended], :to => :deleted