Commit c058aaf7 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Keep namespace name/username synced with user

parent 6eb045fc
...@@ -10,12 +10,11 @@ class UserObserver < BaseObserver ...@@ -10,12 +10,11 @@ class UserObserver < BaseObserver
end end
def after_save user def after_save user
if user.username_changed? # Ensure user has namespace
if user.namespace user.create_namespace!(path: user.username, name: user.username) unless user.namespace
user.namespace.update_attributes(path: user.username)
else if user.username_changed? || user.name_changed?
user.create_namespace!(path: user.username, name: user.username) user.namespace.update_attributes(path: user.username, name: user.name)
end
end end
end end
end 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