Allow user to remove public email address

This commit is contained in:
Robert Speicher 2015-06-23 21:22:00 -04:00
parent 764b5913c8
commit 7e4829c3e9
1 changed files with 3 additions and 1 deletions

View File

@ -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