summaryrefslogtreecommitdiff
path: root/app/models/project.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-10-21 10:09:32 +0200
committerDouwe Maan <douwe@gitlab.com>2015-10-21 10:09:32 +0200
commite17e5a5ce462022761d3cdc29d677f968ca9738a (patch)
tree3066397d58271c1c461189c9bc8768044c7a3fd3 /app/models/project.rb
parent2f7fc7e9f7e7a43914abe81a510bd0dffa113979 (diff)
downloadgitlab-ce-e17e5a5ce462022761d3cdc29d677f968ca9738a.tar.gz
Move case sensitivity check to find_with_namespace.
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb12
1 files changed, 3 insertions, 9 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index b2a8dde9ba2..f9bed7cf89f 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -235,7 +235,7 @@ class Project < ActiveRecord::Base
where('projects.archived = ?', false).where('LOWER(projects.name) LIKE :query', query: "%#{query.downcase}%")
end
- def find_with_namespace(id, case_sensitive: true)
+ def find_with_namespace(id)
namespace_path, project_path = id.split('/')
return nil if !namespace_path || !project_path
@@ -247,14 +247,8 @@ class Project < ActiveRecord::Base
joins(:namespace).
iwhere('namespaces.path' => namespace_path)
- projects =
- if case_sensitive
- projects.where('projects.path' => project_path)
- else
- projects.iwhere('projects.path' => project_path)
- end
-
- projects.take
+ projects.where('projects.path' => project_path).take ||
+ projects.iwhere('projects.path' => project_path).take
end
def visibility_levels