Commit faa95ba4 authored by James Lopez's avatar James Lopez

fix users update service

parent 7188975c
......@@ -11,10 +11,12 @@ module Users
def execute(validate: true, &block)
yield(@user) if block_given?
user_exists = @user.persisted?
assign_attributes(&block)
if @user.save(validate: validate)
notify_success
notify_success(user_exists)
else
error(@user.errors.full_messages.uniq.join('. '))
end
......@@ -30,8 +32,8 @@ module Users
private
def notify_success
notify_new_user(@user, nil) unless @user.persisted?
def notify_success(user_exists)
notify_new_user(@user, nil) unless user_exists
success
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment