diff options
author | James Lopez <james@jameslopez.es> | 2017-06-22 15:55:05 +0200 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2017-06-23 11:41:42 +0200 |
commit | 12dc3992ea189452532587a2b30b8765c0f09381 (patch) | |
tree | 82e13b6d9821fa9127c258897a037dc057f9510e | |
parent | 0ee002c70ea3711046b8d254b5cba044762e9c05 (diff) | |
download | gitlab-ce-12dc3992ea189452532587a2b30b8765c0f09381.tar.gz |
fix spec failures
-rw-r--r-- | lib/api/users.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/api/users.rb b/lib/api/users.rb index 07e7c774f2b..6d7f2e7e250 100644 --- a/lib/api/users.rb +++ b/lib/api/users.rb @@ -236,7 +236,9 @@ module API user = User.find_by(id: params.delete(:id)) not_found!('User') unless user - if Emails::CreateService.new(current_user, user, declared_params(include_missing: false)).execute(skip_authorization: true) + email = Emails::CreateService.new(current_user, user, declared_params(include_missing: false)).execute + + if email.errors.blank? NotificationService.new.new_email(email) present email, with: Entities::Email else @@ -274,7 +276,7 @@ module API email = user.emails.find_by(id: params[:email_id]) not_found!('Email') unless email - Emails::DestroyService.new(current_user, user, email: email.email).execute(skip_authorization: true) + Emails::DestroyService.new(current_user, user, email: email.email).execute end desc 'Delete a user. Available only for admins.' do @@ -486,9 +488,9 @@ module API requires :email, type: String, desc: 'The new email' end post "emails" do - email = current_user.emails.new(declared_params) + email = Emails::CreateService.new(current_user, current_user, declared_params).execute - if Emails::CreateService.new(current_user, current_user, declared_params).execute + if email.errors.blank? NotificationService.new.new_email(email) present email, with: Entities::Email else |