summaryrefslogtreecommitdiff
path: root/app/validators
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@gitlab.com>2017-04-11 16:21:52 +0200
committerBob Van Landuyt <bob@gitlab.com>2017-05-01 11:14:24 +0200
commit1498a9cb0fb4500737c9d9e88f38c0ddf2b42791 (patch)
tree26e0497c62b9396a658b68f422b89c486763b157 /app/validators
parentf7511caa5f26c071c61908a48440a95c5f45eb69 (diff)
downloadgitlab-ce-1498a9cb0fb4500737c9d9e88f38c0ddf2b42791.tar.gz
Check `has_parent?` for determining validation type
Diffstat (limited to 'app/validators')
-rw-r--r--app/validators/namespace_validator.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/app/validators/namespace_validator.rb b/app/validators/namespace_validator.rb
index 8a0e18612ec..ed71d5ad5b5 100644
--- a/app/validators/namespace_validator.rb
+++ b/app/validators/namespace_validator.rb
@@ -74,7 +74,7 @@ class NamespaceValidator < ActiveModel::EachValidator
preview blob blame raw files create_dir find_file
artifacts graphs refs badges objects folders file])
- STRICT_RESERVED = (TOP_LEVEL_ROUTES | WILDCARD_ROUTES)
+ STRICT_RESERVED = (TOP_LEVEL_ROUTES | WILDCARD_ROUTES).freeze
def self.valid_full_path?(full_path)
path_segments = full_path.split('/')
@@ -120,8 +120,8 @@ class NamespaceValidator < ActiveModel::EachValidator
def validation_type(record)
case record
- when Group
- record.parent_id ? :wildcard : :top_level
+ when Namespace
+ record.has_parent? ? :wildcard : :top_level
when Project
:wildcard
else