]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/user.rb
Add extra user transitions needed by the administrators
[rails.git] / app / models / user.rb
index 123ef3230e39fd025dc3e06bd1c1a2e219486d8c..cc12adecc467c66a39aab7adab446cc0d4a5ccfb 100644 (file)
@@ -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