gitlab-org--gitlab-foss/app/observers/user_observer.rb

21 lines
539 B
Ruby
Raw Normal View History

class UserObserver < BaseObserver
def after_create(user)
2012-09-11 16:24:53 -04:00
log_info("User \"#{user.name}\" (#{user.email}) was created")
notification.new_user(user)
end
2012-09-11 16:24:53 -04:00
def after_destroy user
log_info("User \"#{user.name}\" (#{user.email}) was removed")
end
def after_save user
# Ensure user has namespace
user.create_namespace!(path: user.username, name: user.username) unless user.namespace
if user.username_changed?
user.namespace.update_attributes(path: user.username, name: user.username)
end
end
end