Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2017-06-22 09:55:07 +0300
committerJames Lopez <james@jameslopez.es>2017-06-23 12:41:42 +0300
commit785cbb79e255c8369ca5eb916207304f39d188ad (patch)
treeabd792d12be1f35d868db591793311eb32d92370 /app/services/emails
parent0c8e7f49d1ef32ed5ea1bdd7e26dd5e169bad359 (diff)
refactor emails service
Diffstat (limited to 'app/services/emails')
-rw-r--r--app/services/emails/destroy_service.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/app/services/emails/destroy_service.rb b/app/services/emails/destroy_service.rb
index 1275d31efb0..8150918986c 100644
--- a/app/services/emails/destroy_service.rb
+++ b/app/services/emails/destroy_service.rb
@@ -3,7 +3,17 @@ module Emails
def execute(skip_authorization: false)
raise Gitlab::Access::AccessDeniedError unless skip_authorization || can_manage_emails?
- Email.find_by_email(@email).destroy
+ Email.find_by_email(@email).destroy && update_secondary_emails!
+ end
+
+ private
+
+ def update_secondary_emails!
+ result = ::Users::UpdateService.new(@current_user, @current_user).execute do |user|
+ user.update_secondary_emails!
+ end
+
+ result[:status] == 'success'
end
end
end