diff options
author | Robin Houston <robin.houston@gmail.com> | 2011-09-07 13:03:48 +0100 |
---|---|---|
committer | Robin Houston <robin.houston@gmail.com> | 2011-09-07 13:03:48 +0100 |
commit | 47452ffe5a27300b6e1898941fa754b2ef166ef8 (patch) | |
tree | ce3f50f779e579a32fd0c66be3cfa683f15b69bc | |
parent | 599330ac8f985768933236a2d761e9396735fdbb (diff) | |
parent | 6e200cc8e025d1989fcfacb99b7e9e70cf7540d1 (diff) |
Merge branch 'wdtk' of github.com:sebbacon/alaveteli into wdtk
-rw-r--r-- | app/models/user.rb | 22 | ||||
m--------- | commonlib | 0 |
2 files changed, 22 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index fddb6b035..1043474d3 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -16,6 +16,8 @@ # admin_level :string(255) default("none"), not null # ban_text :text default(""), not null # about_me :text default(""), not null +# email_bounced_at :datetime +# email_bounce_message :string(1024) default(""), not null # # models/user.rb: @@ -351,5 +353,25 @@ class User < ActiveRecord::Base def create_new_salt 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) + return false if user.nil? + + if user.self.email_bounced_at.nil? + user.record_bounce(message) + end + return true + end end diff --git a/commonlib b/commonlib -Subproject cf056c6678d59f74fc29eb2b2c1427573fc643a +Subproject a87ebeae21166b3b4a8a66b32399861fcd6d0c4 |