Commit 96105e21 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Update namespace if user changed username. Dont move project if new record

parent 5ca17723
class ProjectObserver < ActiveRecord::Observer
def before_save(project)
# Move repository if namespace changed
if project.namespace_id_changed?
if project.namespace_id_changed? and not project.new_record?
move_project(project)
end
end
......
......@@ -9,6 +9,12 @@ class UserObserver < ActiveRecord::Observer
log_info("User \"#{user.name}\" (#{user.email}) was removed")
end
def after_save user
if user.username_changed?
user.namespace.update_attributes(code: user.username)
end
end
protected
def log_info message
......
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