Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
8d4cc9cb
Commit
8d4cc9cb
authored
May 17, 2017
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #32474
Older namespace records may be both `type == ‘Group` AND `owner_id` is not null.
parent
0b946a7b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
4 deletions
+16
-4
app/models/user.rb
app/models/user.rb
+3
-1
spec/models/user_spec.rb
spec/models/user_spec.rb
+13
-3
No files found.
app/models/user.rb
View file @
8d4cc9cb
...
...
@@ -351,7 +351,9 @@ class User < ActiveRecord::Base
def
find_by_full_path
(
path
,
follow_redirects:
false
)
namespace
=
Namespace
.
find_by_full_path
(
path
,
follow_redirects:
follow_redirects
)
namespace
&
.
owner
return
unless
namespace
&&
namespace
.
kind
==
'user'
namespace
.
owner
end
def
reference_prefix
...
...
spec/models/user_spec.rb
View file @
8d4cc9cb
...
...
@@ -929,10 +929,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