diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/models/namespace.rb | 4 | ||||
-rw-r--r-- | app/validators/namespace_validator.rb | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/app/models/namespace.rb b/app/models/namespace.rb index 9bfa731785f..1570470d63f 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -220,6 +220,10 @@ class Namespace < ActiveRecord::Base Project.inside_path(full_path) end + def has_parent? + parent.present? + end + private def repository_storage_paths 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 |