diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-06-24 04:22:00 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-06-24 04:22:00 +0300 |
commit | 7e4829c3e94fa3bdeee50d0b96785f0aa833829e (patch) | |
tree | 86e514c254dfe28b94d8cb2ba4cb403e87bd77d0 /app | |
parent | 764b5913c8f960d09d4777e3233662f507b0ec13 (diff) |
Allow user to remove public email address
Diffstat (limited to 'app')
-rw-r--r-- | app/models/user.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 22cd15bf971..f1bcecc13b3 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -351,6 +351,8 @@ class User < ActiveRecord::Base end def owns_public_email + return if self.public_email.blank? + self.errors.add(:public_email, "is not an email you own") unless self.all_emails.include?(self.public_email) end @@ -531,7 +533,7 @@ class User < ActiveRecord::Base def set_public_email if self.public_email.blank? || !self.all_emails.include?(self.public_email) - self.public_email = nil + self.public_email = '' end end |