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
7a6d820a
Commit
7a6d820a
authored
Dec 17, 2019
by
Jarka Košanová
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix transfering groups to root for EE
parent
7a8057fd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
4 deletions
+28
-4
changelogs/unreleased/fix-group-transfer.yml
changelogs/unreleased/fix-group-transfer.yml
+5
-0
ee/app/services/ee/groups/transfer_service.rb
ee/app/services/ee/groups/transfer_service.rb
+3
-3
ee/spec/services/groups/transfer_service_spec.rb
ee/spec/services/groups/transfer_service_spec.rb
+20
-1
No files found.
changelogs/unreleased/fix-group-transfer.yml
0 → 100644
View file @
7a6d820a
---
title
:
Fix transferring groups to root when EE features are enabled
merge_request
:
21915
author
:
type
:
fixed
ee/app/services/ee/groups/transfer_service.rb
View file @
7a6d820a
...
...
@@ -17,7 +17,7 @@ module EE
return
unless
group
.
packages_feature_available?
npm_packages
=
Packages
::
GroupPackagesFinder
.
new
(
current_user
,
group
,
package_type: :npm
).
execute
if
!
new_parent_group_has_same
_root_ancestor?
&&
npm_packages
.
exists?
if
different
_root_ancestor?
&&
npm_packages
.
exists?
raise_ee_transfer_error
(
:group_contains_npm_packages
)
end
end
...
...
@@ -44,8 +44,8 @@ module EE
raise
::
Groups
::
TransferService
::
TransferError
,
EE_ERROR_MESSAGES
[
message
]
end
def
new_parent_group_has_same
_root_ancestor?
group
.
root_ancestor
==
new_parent_group
.
root_ancestor
def
different
_root_ancestor?
group
.
root_ancestor
!=
new_parent_group
&
.
root_ancestor
end
end
end
...
...
ee/spec/services/groups/transfer_service_spec.rb
View file @
7a6d820a
...
...
@@ -12,7 +12,7 @@ describe Groups::TransferService, '#execute' do
before
do
stub_licensed_features
(
packages:
true
)
group
.
add_owner
(
user
)
new_group
.
add_owner
(
user
)
new_group
&
.
add_owner
(
user
)
end
context
'with an npm package'
do
...
...
@@ -50,6 +50,25 @@ describe Groups::TransferService, '#execute' do
expect
(
group
.
parent
).
to
eq
(
new_group
)
end
end
context
'when transferring a group into a root group'
do
let
(
:new_group
)
{
nil
}
it_behaves_like
'transfer not allowed'
end
end
end
context
'without an npm package'
do
context
'when transferring a group into a root group'
do
let
(
:group
)
{
create
(
:group
,
parent:
create
(
:group
))
}
it
'allows transfer'
do
transfer_service
.
execute
(
nil
)
expect
(
transfer_service
.
error
).
not_to
be
expect
(
group
.
parent
).
to
be_nil
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