summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorJan Provaznik <jprovaznik@gitlab.com>2019-07-12 12:59:38 +0000
committerJan Provaznik <jprovaznik@gitlab.com>2019-07-12 12:59:38 +0000
commit907154957ef89c1f0df1de3c665418146cc93f98 (patch)
treea78292af3d7f93f943133c36b29647a7cdf04dcd /app/models
parentfd407d065861b092dfc4f53ef76ab44991998753 (diff)
parent82e6ed310b1bb5e7faf44742defaf65b74926195 (diff)
downloadgitlab-ce-907154957ef89c1f0df1de3c665418146cc93f98.tar.gz
Merge branch 'bvl-rename-routes-after-user-rename' into 'master'
Set the name of a user-namespace to the user name See merge request gitlab-org/gitlab-ce!23272
Diffstat (limited to 'app/models')
-rw-r--r--app/models/namespace.rb3
-rw-r--r--app/models/user.rb5
2 files changed, 4 insertions, 4 deletions
diff --git a/app/models/namespace.rb b/app/models/namespace.rb
index af50293a179..1d95590bac9 100644
--- a/app/models/namespace.rb
+++ b/app/models/namespace.rb
@@ -41,8 +41,7 @@ class Namespace < ApplicationRecord
validates :owner, presence: true, unless: ->(n) { n.type == "Group" }
validates :name,
presence: true,
- length: { maximum: 255 },
- namespace_name: true
+ length: { maximum: 255 }
validates :description, length: { maximum: 255 }
validates :path,
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