Commit 2c620713 authored by Zeger-Jan van de Weg's avatar Zeger-Jan van de Weg

Allow temp-oauth-email as notification email

parent 95c7aa62
...@@ -18,6 +18,7 @@ v 8.7.0 (unreleased) ...@@ -18,6 +18,7 @@ v 8.7.0 (unreleased)
v 8.6.3 (unreleased) v 8.6.3 (unreleased)
- Destroy related todos when an Issue/MR is deleted. !3376 - Destroy related todos when an Issue/MR is deleted. !3376
- Fix error 500 when target is nil on todo list. !3376 - Fix error 500 when target is nil on todo list. !3376
- Allow temporary email as notification email. !TBD
v 8.6.2 v 8.6.2
- Fix dropdown alignment. !3298 - Fix dropdown alignment. !3298
......
...@@ -408,6 +408,8 @@ class User < ActiveRecord::Base ...@@ -408,6 +408,8 @@ class User < ActiveRecord::Base
end end
def owns_notification_email 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) self.errors.add(:notification_email, "is not an email you own") unless self.all_emails.include?(self.notification_email)
end end
......
...@@ -173,6 +173,13 @@ describe User, models: true do ...@@ -173,6 +173,13 @@ describe User, models: true do
expect(user).to be_invalid expect(user).to be_invalid
end end
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
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