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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
e19526c2
Commit
e19526c2
authored
Sep 12, 2013
by
Stephen Holdaway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix several_namespaces? to work with multiple ownership of groups
parent
c7cb7599
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletion
+14
-1
app/models/user.rb
app/models/user.rb
+1
-1
spec/models/user_spec.rb
spec/models/user_spec.rb
+13
-0
No files found.
app/models/user.rb
View file @
e19526c2
...
@@ -322,7 +322,7 @@ class User < ActiveRecord::Base
...
@@ -322,7 +322,7 @@ class User < ActiveRecord::Base
end
end
def
several_namespaces?
def
several_namespaces?
namespaces
.
many?
namespaces
.
many?
||
owned_groups
.
any?
end
end
def
namespace_id
def
namespace_id
...
...
spec/models/user_spec.rb
View file @
e19526c2
...
@@ -139,6 +139,19 @@ describe User do
...
@@ -139,6 +139,19 @@ describe User do
it
{
@user
.
owned_groups
.
should
==
[
@group
]
}
it
{
@user
.
owned_groups
.
should
==
[
@group
]
}
end
end
describe
'group multiple owners'
do
before
do
ActiveRecord
::
Base
.
observers
.
enable
(
:user_observer
)
@user
=
create
:user
@user2
=
create
:user
@group
=
create
:group
,
owner:
@user
@group
.
add_users
([
@user2
.
id
],
UsersGroup
::
OWNER
)
end
it
{
@user2
.
several_namespaces?
.
should
be_true
}
end
describe
'namespaced'
do
describe
'namespaced'
do
before
do
before
do
ActiveRecord
::
Base
.
observers
.
enable
(
:user_observer
)
ActiveRecord
::
Base
.
observers
.
enable
(
:user_observer
)
...
...
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