]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/spam_observer.rb
Use cache store for sessions when memcached is not available
[rails.git] / app / models / spam_observer.rb
index 21561f6718fd330704d528de86a2805ddbbbc262..888b4a0b9cb6719624a509a343dc21fc717857f4 100644 (file)
@@ -3,12 +3,12 @@ class SpamObserver < ActiveRecord::Observer
 
   def after_save(record)
     case
 
   def after_save(record)
     case
-    when record.is_a?(User): user = record
-    when record.is_a?(DiaryEntry): user = record.user
-    when record.is_a?(DiaryComment): user = record.user
+    when record.is_a?(User) then user = record
+    when record.is_a?(DiaryEntry) then user = record.user
+    when record.is_a?(DiaryComment) then user = record.user
     end
 
     end
 
-    if user.status == "active" and user.spam_score > APP_CONFIG['spam_threshold']
+    if user.status == "active" and user.spam_score > SPAM_THRESHOLD
       user.update_attributes(:status => "suspended")
     end
   end
       user.update_attributes(:status => "suspended")
     end
   end