Skip to content

Commit

Permalink
fix: enable user creation notification (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni authored Apr 29, 2024
1 parent 0fada75 commit 73309f6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ class UsersController < ApplicationController
private


def create_user
def create_user(send_notifications: true)
params ||= @params
user = User.find(params["username"]).first
error 409, "User with username `#{params["username"]}` already exists" unless user.nil?
params.delete("role") unless current_user.admin?
user = instance_from_params(User, params)
if user.valid?
user.save(send_notifications: false)
user.save(send_notifications: send_notifications)
else
error 422, user.errors
end
Expand Down

0 comments on commit 73309f6

Please sign in to comment.