aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/user.rb
diff options
context:
space:
mode:
authorRobin Houston <robin@lenny.robin>2011-09-07 23:41:26 +0100
committerRobin Houston <robin@lenny.robin>2011-09-07 23:41:26 +0100
commit91edbbf49d717d2b559153a0bf151879f12087bc (patch)
treed68a3a2519c4059c132f04e598cf379d87f81a47 /app/models/user.rb
parentcda7e0d3bd09cd6635286861fe93b8fa4ad48c7d (diff)
Fix “email bounced” recording
Add tests for the User.record_bounce_for_email method and (not coincidentally) make it actually work.
Diffstat (limited to 'app/models/user.rb')
-rw-r--r--app/models/user.rb16
1 files changed, 8 insertions, 8 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 82c7c5fae..aee701031 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -343,6 +343,12 @@ class User < ActiveRecord::Base
}
end
+ def record_bounce(message)
+ self.email_bounced_at = Time.now
+ self.email_bounce_message = message
+ self.save!
+ end
+
private
def User.encrypted_password(password, salt)
@@ -354,21 +360,15 @@ class User < ActiveRecord::Base
self.salt = self.object_id.to_s + rand.to_s
end
- def record_bounce(message)
- self.email_bounced_at = Time.now
- self.email_bounce_message = message
- self.save!
- end
-
def should_be_emailed?
return (self.email_confirmed && self.email_bounced_at.nil?)
end
def User.record_bounce_for_email(email, message)
- user = self.find_user_by_email(email)
+ user = User.find_user_by_email(email)
return false if user.nil?
- if user.self.email_bounced_at.nil?
+ if user.email_bounced_at.nil?
user.record_bounce(message)
end
return true