Use an observer to watch all diary and user updates and, if the user
is not confirmed, chek their spam score and suspend then if it has got
too high.
--- /dev/null
+class SpamObserver < ActiveRecord::Observer
+ observe User, DiaryEntry, DiaryComment
+
+ 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
+ end
+
+ if user.status == "active" and user.spam_score > APP_CONFIG['spam_threshold']
+ user.update_attributes(:status => "suspended")
+ end
+ end
+end
# Quova authentication details
#quova_username: ""
#quova_password: ""
+ # Spam threshold
+ spam_theshold: 50
development:
<<: *standard_settings
config.active_record.schema_format = :sql
# Activate observers that should always be running
- # config.active_record.observers = :cacher, :garbage_collector
+ config.active_record.observers = :spam_observer
# Make Active Record use UTC-base instead of local time
config.active_record.default_timezone = :utc