Skip to content
Snippets Groups Projects
Commit 21e402e7 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

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
No related branches found
No related tags found
No related merge requests found
Loading
@@ -351,6 +351,8 @@ class User < ActiveRecord::Base
Loading
@@ -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
   
Loading
@@ -531,7 +533,7 @@ class User < ActiveRecord::Base
Loading
@@ -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
   
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment