Commit 25f68a71 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Project must have namespace for Project#find_with_namespace

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 17a9ecf8
...@@ -177,15 +177,13 @@ class Project < ActiveRecord::Base ...@@ -177,15 +177,13 @@ class Project < ActiveRecord::Base
end end
def find_with_namespace(id) def find_with_namespace(id)
if id.include?("/") return nil unless id.include?("/")
id = id.split("/")
namespace = Namespace.find_by(path: id.first) id = id.split("/")
return nil unless namespace namespace = Namespace.find_by(path: id.first)
return nil unless namespace
where(namespace_id: namespace.id).find_by(path: id.second)
else where(namespace_id: namespace.id).find_by(path: id.second)
where(path: id, namespace_id: nil).last
end
end end
def visibility_levels def visibility_levels
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment