提交 c058aaf7 编写于 作者: D Dmitriy Zaporozhets

Keep namespace name/username synced with user

上级 6eb045fc
......@@ -10,12 +10,11 @@ class UserObserver < BaseObserver
end
def after_save user
if user.username_changed?
if user.namespace
user.namespace.update_attributes(path: user.username)
else
user.create_namespace!(path: user.username, name: user.username)
end
# Ensure user has namespace
user.create_namespace!(path: user.username, name: user.username) unless user.namespace
if user.username_changed? || user.name_changed?
user.namespace.update_attributes(path: user.username, name: user.name)
end
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册