Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gpt
large_projects
gitlabhq1
Commits
2505fb7b
Commit
2505fb7b
authored
8 years ago
by
Douwe Maan
Browse files
Options
Download
Email Patches
Plain Diff
Use Namespace.for_user scope (formerly known as Namespace.root)
parent
8d4cc9cb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
5 deletions
+3
-5
app/models/namespace.rb
app/models/namespace.rb
+1
-1
app/models/user.rb
app/models/user.rb
+2
-4
No files found.
app/models/namespace.rb
View file @
2505fb7b
...
...
@@ -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'
)
...
...
This diff is collapsed.
Click to expand it.
app/models/user.rb
View file @
2505fb7b
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment