Commit 46ae8325 authored by Douwe Maan's avatar Douwe Maan Committed by Michael Kozono

Use Namespace.for_user scope (formerly known as Namespace.root)

parent e1cc4671
......@@ -47,7 +47,7 @@ class Namespace < ActiveRecord::Base
before_destroy(prepend: true) { prepare_for_destroy }
after_destroy :rm_dir
scope :root, -> { where('type IS NULL') }
scope :for_user, -> { where('type IS NULL') }
scope :with_statistics, -> do
joins('LEFT JOIN project_statistics ps ON ps.namespace_id = namespaces.id')
......
......@@ -371,10 +371,8 @@ class User < ActiveRecord::Base
end
def find_by_full_path(path, follow_redirects: false)
namespace = Namespace.find_by_full_path(path, follow_redirects: follow_redirects)
return unless namespace && namespace.kind == 'user'
namespace.owner
namespace = Namespace.for_user.find_by_full_path(path, follow_redirects: follow_redirects)
namespace&.owner
end
def non_ldap
......
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