summaryrefslogtreecommitdiff
path: root/app/models/namespace.rb
diff options
context:
space:
mode:
authorZ.J. van de Weg <git@zjvandeweg.nl>2017-03-02 10:22:56 +0100
committerZ.J. van de Weg <git@zjvandeweg.nl>2017-03-02 10:22:56 +0100
commitddfd09c09cb904529df567e5606d76c467ed856f (patch)
treed17a48cf08e580cac866417700ea1ffe74c48bd7 /app/models/namespace.rb
parent52c4a7866ed010d8db67e5ca976d8c73d4084784 (diff)
parent3b3f0fab452fb9cbe4fbe7f75112bef3a7f9d039 (diff)
downloadgitlab-ce-ddfd09c09cb904529df567e5606d76c467ed856f.tar.gz
Merge branch 'master' into zj-create-mattermost-team
Diffstat (limited to 'app/models/namespace.rb')
-rw-r--r--app/models/namespace.rb10
1 files changed, 2 insertions, 8 deletions
diff --git a/app/models/namespace.rb b/app/models/namespace.rb
index 229cbee08c6..d350f1d6770 100644
--- a/app/models/namespace.rb
+++ b/app/models/namespace.rb
@@ -99,14 +99,8 @@ class Namespace < ActiveRecord::Base
# Work around that by setting their username to "blank", followed by a counter.
path = "blank" if path.blank?
- counter = 0
- base = path
- while Namespace.find_by_path_or_name(path)
- counter += 1
- path = "#{base}#{counter}"
- end
-
- path
+ uniquify = Uniquify.new
+ uniquify.string(path) { |s| Namespace.find_by_path_or_name(s) }
end
end