diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-11-21 12:17:14 +0100 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2019-07-09 18:09:45 +0200 |
commit | 5f08830090fb6d56a14bd4aaca107b99e2b0975b (patch) | |
tree | fa1f2c2a8aa36e414bb305876a19eaf75a2c88ff /app/models/user.rb | |
parent | db1b15e4245547a4468ab70d337a73a40d4fc98c (diff) | |
download | gitlab-ce-5f08830090fb6d56a14bd4aaca107b99e2b0975b.tar.gz |
Set the name of a user-namespace to the user name
Instead of setting the name of the namespace to the user's username,
set it to the user's name.
This is more consistent with how we name the routes:
The route-name of a namespace is the human name of the routable. In
the case of a user-namespace, this is the owner's name.
When we change a user's name (both on create and update), we now also
update the namespace-name to the user's name. This will make sure that
if we also correctly update all the nested routes.
Diffstat (limited to 'app/models/user.rb')
-rw-r--r-- | app/models/user.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 26be197209a..02637b70f03 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1117,9 +1117,10 @@ class User < ApplicationRecord def ensure_namespace_correct if namespace - namespace.path = namespace.name = username if username_changed? + namespace.path = username if username_changed? + namespace.name = name if name_changed? else - build_namespace(path: username, name: username) + build_namespace(path: username, name: name) end end |