summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-04-01 14:12:42 +0000
committerRémy Coutable <remy@rymai.me>2016-04-01 14:12:42 +0000
commitf9ab215b217c5202644000fd29c4b90b3bbb14c4 (patch)
treee1b5efad6d5509e4383621c141213648753cfcfd
parente3f0bef5ee8ece2e949239c5c43a30477431681b (diff)
parent2c6207135e917a0b8f25f657916060405f1f85b5 (diff)
downloadgitlab-ce-f9ab215b217c5202644000fd29c4b90b3bbb14c4.tar.gz
Merge branch 'error-when-ldap-doesn-t-supply-an-email-address-14559' into 'master'
Allow temp-oauth-email as notification email Closes #14559 /cc @dblessing @rymai See merge request !3477
-rw-r--r--CHANGELOG1
-rw-r--r--app/models/user.rb2
-rw-r--r--spec/models/user_spec.rb7
3 files changed, 10 insertions, 0 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 744e6b70ba1..a4f49590760 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -20,6 +20,7 @@ v 8.7.0 (unreleased)
v 8.6.3 (unreleased)
- Destroy related todos when an Issue/MR is deleted. !3376
- Fix error 500 when target is nil on todo list. !3376
+ - Allow temporary email as notification email. !TBD
v 8.6.3
- Fix copying uploads when moving issue to another project
diff --git a/app/models/user.rb b/app/models/user.rb
index 128ddc2a694..2b0bee2099f 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -408,6 +408,8 @@ class User < ActiveRecord::Base
end
def owns_notification_email
+ return if self.temp_oauth_email?
+
self.errors.add(:notification_email, "is not an email you own") unless self.all_emails.include?(self.notification_email)
end
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 0ab7fd88ce6..8b2fb77e28e 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -173,6 +173,13 @@ describe User, models: true do
expect(user).to be_invalid
end
end
+
+ context 'owns_notification_email' do
+ it 'accepts temp_oauth_email emails' do
+ user = build(:user, email: "temp-email-for-oauth@example.com")
+ expect(user).to be_valid
+ end
+ end
end
end