diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-05-18 08:56:54 -0500 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-05-18 08:56:54 -0500 |
commit | 2505fb7b656815f3099ba2d34b447b254d8ec37e (patch) | |
tree | ad9af4d77facace579f6adb22a683348022523c9 | |
parent | 8d4cc9cbe07d96ee34dd2559e34b38b712c3b3b4 (diff) | |
download | gitlab-ce-2505fb7b656815f3099ba2d34b447b254d8ec37e.tar.gz |
Use Namespace.for_user scope (formerly known as Namespace.root)mk-fix-issue-1843
-rw-r--r-- | app/models/namespace.rb | 2 | ||||
-rw-r--r-- | app/models/user.rb | 6 |
2 files changed, 3 insertions, 5 deletions
diff --git a/app/models/namespace.rb b/app/models/namespace.rb index a7ede5e3b9e..4d59267f71d 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -46,7 +46,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') diff --git a/app/models/user.rb b/app/models/user.rb index 7d71b0773e0..d63641891fd 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -350,10 +350,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 reference_prefix |