BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
8cba1f51
Commit
8cba1f51
authored
May 18, 2017
by
Douwe Maan
Committed by
Regis
May 18, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge branch 'mk-fix-issue-1843' into 'master'
Fix root groups redirecting to group owner Closes #32474 See merge request !11465
parent
8fa6b11c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
5 deletions
+15
-5
namespace.rb
app/models/namespace.rb
+1
-1
user.rb
app/models/user.rb
+1
-1
user_spec.rb
spec/models/user_spec.rb
+13
-3
No files found.
app/models/namespace.rb
View file @
8cba1f51
...
...
@@ -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'
)
...
...
app/models/user.rb
View file @
8cba1f51
...
...
@@ -338,7 +338,7 @@ 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
)
namespace
=
Namespace
.
f
or_user
.
f
ind_by_full_path
(
path
,
follow_redirects:
follow_redirects
)
namespace
&
.
owner
end
...
...
spec/models/user_spec.rb
View file @
8cba1f51
...
...
@@ -900,10 +900,20 @@ describe User, models: true do
end
context
'with a group route matching the given path'
do
let!
(
:group
)
{
create
(
:group
,
path:
'group_path'
)
}
context
'when the group namespace has an owner_id (legacy data)'
do
let!
(
:group
)
{
create
(
:group
,
path:
'group_path'
,
owner:
user
)
}
it
'returns nil'
do
expect
(
User
.
find_by_full_path
(
'group_path'
)).
to
eq
(
nil
)
it
'returns nil'
do
expect
(
User
.
find_by_full_path
(
'group_path'
)).
to
eq
(
nil
)
end
end
context
'when the group namespace does not have an owner_id'
do
let!
(
:group
)
{
create
(
:group
,
path:
'group_path'
)
}
it
'returns nil'
do
expect
(
User
.
find_by_full_path
(
'group_path'
)).
to
eq
(
nil
)
end
end
end
end
...
...
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