summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-06-24 08:30:44 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-06-24 08:30:44 +0000
commit21e402e7ca194659b0402112191c0852d3c7d860 (patch)
tree86e514c254dfe28b94d8cb2ba4cb403e87bd77d0
parent764b5913c8f960d09d4777e3233662f507b0ec13 (diff)
parent7e4829c3e94fa3bdeee50d0b96785f0aa833829e (diff)
downloadgitlab-ce-21e402e7ca194659b0402112191c0852d3c7d860.tar.gz
Merge branch 'rs-dev-issue-2419' into 'master'
Allow user to remove public email address Closes internal https://dev.gitlab.org/gitlab/gitlabhq/issues/2419 See merge request !880
-rw-r--r--app/models/user.rb4
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