summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-12-14 15:19:17 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-12-14 15:19:17 +0000
commitabad9a9b41f549e9660ac21a978dca4033efa777 (patch)
tree4af12a6ef4f7ead85c2d80a48687f42c492564fa /app
parentb70b962892b2428557d95a9639fbcead4fe546fd (diff)
parent4bdfb0391a578847fde5589eb44ac6737c9e4b64 (diff)
downloadgitlab-ce-abad9a9b41f549e9660ac21a978dca4033efa777.tar.gz
Merge branch 'dz-remove-namespaces-path-uniq' into 'master'
Modify namespace name and path validation ## What does this MR do? * Allow same namespace name with different parent_id * Allow same namespace path. Uniq validation should be handled by routes table ## Are there points in the code the reviewer needs to double check? migrations ## Why was this MR needed? So we can use same name in different nesting like: ``` gitlab-ce/foo gitlab-com/foo foo/gitlab-ce ``` ## Screenshots (if relevant) no ## Does this MR meet the acceptance criteria? - ~~[Changelog entry](https://docs.gitlab.com/ce/development/changelog.html) added~~ - ~~[Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)~~ - ~~API support added~~ - Tests - [x] Added for this feature/bug - [x] All builds are passing - [x] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html) - [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [x] Branch has no merge conflicts with `master` (if it does - rebase it please) - [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) ## What are the relevant issue numbers? https://gitlab.com/gitlab-org/gitlab-ce/issues/2772 See merge request !8013
Diffstat (limited to 'app')
-rw-r--r--app/models/namespace.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/app/models/namespace.rb b/app/models/namespace.rb
index 37374044551..f0479d94986 100644
--- a/app/models/namespace.rb
+++ b/app/models/namespace.rb
@@ -17,14 +17,13 @@ class Namespace < ActiveRecord::Base
validates :owner, presence: true, unless: ->(n) { n.type == "Group" }
validates :name,
presence: true,
- uniqueness: true,
+ uniqueness: { scope: :parent_id },
length: { maximum: 255 },
namespace_name: true
validates :description, length: { maximum: 255 }
validates :path,
presence: true,
- uniqueness: { case_sensitive: false },
length: { maximum: 255 },
namespace: true