diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-17 15:08:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-17 15:08:42 +0300 |
commit | b487021bd3f785d6348c13746fda6ce9043a99c5 (patch) | |
tree | e75c483fae6089d597c9150a6e571ee17d589fe9 /app/models/notification_setting.rb | |
parent | 0fd229655348c98448022fd293b42666b28eace5 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/notification_setting.rb')
-rw-r--r-- | app/models/notification_setting.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/models/notification_setting.rb b/app/models/notification_setting.rb index 4323f89865a..2e45753c182 100644 --- a/app/models/notification_setting.rb +++ b/app/models/notification_setting.rb @@ -16,7 +16,7 @@ class NotificationSetting < ApplicationRecord validates :user_id, uniqueness: { scope: [:source_type, :source_id], message: "already exists in source", allow_nil: true } - validate :owns_notification_email, if: :notification_email_changed? + validate :notification_email_verified, if: :notification_email_changed? scope :for_groups, -> { where(source_type: 'Namespace') } @@ -110,11 +110,11 @@ class NotificationSetting < ApplicationRecord has_attribute?(event) && !!read_attribute(event) end - def owns_notification_email + def notification_email_verified return if user.temp_oauth_email? return if notification_email.empty? - errors.add(:notification_email, _("is not an email you own")) unless user.verified_emails.include?(notification_email) + errors.add(:notification_email, _("must be an email you have verified")) unless user.verified_emails.include?(notification_email) end end |