summaryrefslogtreecommitdiff
path: root/app/services/emails
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-11-04 00:12:36 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-11-04 00:12:36 +0000
commit4e86ca506d67f27cb4ca93b47efc53adc1c237a6 (patch)
tree8a3babe70df855216f3a9f184e3767fdd26aec57 /app/services/emails
parent16f41a5b04934bb7a7a26ac2d6516cb44b7932e3 (diff)
downloadgitlab-ce-4e86ca506d67f27cb4ca93b47efc53adc1c237a6.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/emails')
-rw-r--r--app/services/emails/destroy_service.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/app/services/emails/destroy_service.rb b/app/services/emails/destroy_service.rb
index d10833e66cb..d211c3470b2 100644
--- a/app/services/emails/destroy_service.rb
+++ b/app/services/emails/destroy_service.rb
@@ -3,6 +3,8 @@
module Emails
class DestroyService < ::Emails::BaseService
def execute(email)
+ raise StandardError, 'Cannot delete primary email' if email.user_primary_email?
+
email.destroy && update_secondary_emails!(email.email)
end