Commit 21e402e7 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

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
parents 764b5913 7e4829c3
...@@ -351,6 +351,8 @@ class User < ActiveRecord::Base ...@@ -351,6 +351,8 @@ class User < ActiveRecord::Base
end end
def owns_public_email 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) self.errors.add(:public_email, "is not an email you own") unless self.all_emails.include?(self.public_email)
end end
...@@ -531,7 +533,7 @@ class User < ActiveRecord::Base ...@@ -531,7 +533,7 @@ class User < ActiveRecord::Base
def set_public_email def set_public_email
if self.public_email.blank? || !self.all_emails.include?(self.public_email) if self.public_email.blank? || !self.all_emails.include?(self.public_email)
self.public_email = nil self.public_email = ''
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment