mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-11 21:56:19 +10:00
Keep namespace name/username synced with user
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user