X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/160429e62d88810ec49ccc9c504edee675dca080..6e33cf087185c8b3a7831d5e8b70b0867487b5ea:/app/models/spam_observer.rb?ds=sidebyside diff --git a/app/models/spam_observer.rb b/app/models/spam_observer.rb index 21561f671..07fa84ffd 100644 --- a/app/models/spam_observer.rb +++ b/app/models/spam_observer.rb @@ -3,13 +3,13 @@ class SpamObserver < ActiveRecord::Observer 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 - if user.status == "active" and user.spam_score > APP_CONFIG['spam_threshold'] - user.update_attributes(:status => "suspended") + if user.status == "active" and user.spam_score > SPAM_THRESHOLD + user.update_column(:status, "suspended") end end end