From b76ae638462ab0f673e5915986070518dd3f9ad3 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 19 Aug 2021 09:08:42 +0000 Subject: Add latest changes from gitlab-org/gitlab@14-2-stable-ee --- app/models/notification_setting.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app/models/notification_setting.rb') 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 -- cgit v1.2.3