diff options
author | James Lopez <james@jameslopez.es> | 2017-06-23 17:11:31 +0200 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2017-06-23 17:11:31 +0200 |
commit | b33c638483d6b87ba71a329275ff12e5eb865d72 (patch) | |
tree | af7f0c3caac54bad865e651654772d575d9d0e4b /app/services/users/update_service.rb | |
parent | 8f2adb8084c15026115aed39a06e9af04c5e7957 (diff) | |
download | gitlab-ce-b33c638483d6b87ba71a329275ff12e5eb865d72.tar.gz |
update code based on feedback
Diffstat (limited to 'app/services/users/update_service.rb')
-rw-r--r-- | app/services/users/update_service.rb | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/app/services/users/update_service.rb b/app/services/users/update_service.rb index 2037664f56a..dfbd6016c3f 100644 --- a/app/services/users/update_service.rb +++ b/app/services/users/update_service.rb @@ -1,5 +1,4 @@ module Users - # Service for updating a user. class UpdateService < BaseService def initialize(user, params = {}) @user = user @@ -7,6 +6,8 @@ module Users end def execute(validate: true, &block) + yield(@user) if block_given? + assign_attributes(&block) if @user.save(validate: validate) @@ -27,8 +28,6 @@ module Users private def assign_attributes(&block) - yield(@user) if block_given? - @user.assign_attributes(params) if params.any? end end |