summaryrefslogtreecommitdiff
path: root/app/services/users
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2017-09-20 11:00:06 +0200
committerJames Lopez <james@jameslopez.es>2017-09-28 08:46:39 +0200
commit9621dd0c9d31508bdac2e2e226537302b560ef10 (patch)
treef4e76be89a6cb1a85b04e87cdf33bb408f2bf63f /app/services/users
parent11c8b8bc3c2294ef2e3a33196619f6e61f1e8d82 (diff)
downloadgitlab-ce-9621dd0c9d31508bdac2e2e226537302b560ef10.tar.gz
refactor services to match EE signature
Diffstat (limited to 'app/services/users')
-rw-r--r--app/services/users/update_service.rb12
1 files changed, 7 insertions, 5 deletions
diff --git a/app/services/users/update_service.rb b/app/services/users/update_service.rb
index 6188b8a4349..fddeeb9d52a 100644
--- a/app/services/users/update_service.rb
+++ b/app/services/users/update_service.rb
@@ -12,12 +12,8 @@ module Users
assign_attributes(&block)
- user_exists = @user.persisted?
-
if @user.save(validate: validate)
- notify_new_user(@user, nil) unless user_exists
-
- success
+ notify_success
else
error(@user.errors.full_messages.uniq.join('. '))
end
@@ -33,6 +29,12 @@ module Users
private
+ def notify_success
+ notify_new_user(@user, nil) unless @user.persisted?
+
+ success
+ end
+
def assign_attributes(&block)
if @user.user_synced_attributes_metadata
params.except!(*@user.user_synced_attributes_metadata.read_only_attributes)