summaryrefslogtreecommitdiff
path: root/lib/api/users.rb
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2017-09-27 16:39:10 +0200
committerJames Lopez <james@jameslopez.es>2017-09-28 08:46:39 +0200
commit1dcb7111107ed5a6b6258613d804b8da56af8b35 (patch)
treeccd463f601f4fada16e95dfc57796850aa1b85e7 /lib/api/users.rb
parente07819cbf70511ad38c107dc593ec87606567cdc (diff)
downloadgitlab-ce-1dcb7111107ed5a6b6258613d804b8da56af8b35.tar.gz
refactor emails servicerefactor-services
Diffstat (limited to 'lib/api/users.rb')
-rw-r--r--lib/api/users.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/api/users.rb b/lib/api/users.rb
index ce5d75965d5..99024d1f0ad 100644
--- a/lib/api/users.rb
+++ b/lib/api/users.rb
@@ -326,7 +326,7 @@ module API
user = User.find_by(id: params.delete(:id))
not_found!('User') unless user
- email = Emails::CreateService.new(current_user, user, declared_params(include_missing: false)).execute
+ email = Emails::CreateService.new(current_user, declared_params(include_missing: false).merge(user: user)).execute
if email.errors.blank?
NotificationService.new.new_email(email)
@@ -367,7 +367,7 @@ module API
not_found!('Email') unless email
destroy_conditionally!(email) do |email|
- Emails::DestroyService.new(current_user, user, email: email.email).execute
+ Emails::DestroyService.new(current_user, user: user, email: email.email).execute
end
user.update_secondary_emails!
@@ -672,7 +672,7 @@ module API
requires :email, type: String, desc: 'The new email'
end
post "emails" do
- email = Emails::CreateService.new(current_user, current_user, declared_params).execute
+ email = Emails::CreateService.new(current_user, declared_params.merge(user: current_user)).execute
if email.errors.blank?
NotificationService.new.new_email(email)
@@ -691,7 +691,7 @@ module API
not_found!('Email') unless email
destroy_conditionally!(email) do |email|
- Emails::DestroyService.new(current_user, current_user, email: email.email).execute
+ Emails::DestroyService.new(current_user, user: current_user, email: email.email).execute
end
current_user.update_secondary_emails!