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
dbcd6df7
Commit
dbcd6df7
authored
Nov 02, 2021
by
Alexandru Croitor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove without_project_namespaces scope on children
Children association already filters project namespaces
parent
1dc44ca6
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
5 deletions
+9
-5
app/models/concerns/loaded_in_group_list.rb
app/models/concerns/loaded_in_group_list.rb
+1
-1
spec/models/concerns/loaded_in_group_list_spec.rb
spec/models/concerns/loaded_in_group_list_spec.rb
+1
-1
spec/services/groups/transfer_service_spec.rb
spec/services/groups/transfer_service_spec.rb
+7
-3
No files found.
app/models/concerns/loaded_in_group_list.rb
View file @
dbcd6df7
...
...
@@ -69,7 +69,7 @@ module LoadedInGroupList
end
def
subgroup_count
@subgroup_count
||=
try
(
:preloaded_subgroup_count
)
||
children
.
without_project_namespaces
.
count
@subgroup_count
||=
try
(
:preloaded_subgroup_count
)
||
children
.
count
end
def
member_count
...
...
spec/models/concerns/loaded_in_group_list_spec.rb
View file @
dbcd6df7
...
...
@@ -25,7 +25,7 @@ RSpec.describe LoadedInGroupList do
context
'with project namespaces'
do
let_it_be
(
:group1
)
{
create
(
:group
,
parent:
parent
)
}
let_it_be
(
:group2
)
{
create
(
:group
,
parent:
parent
)
}
let_it_be
(
:project_namespace
)
{
create
(
:project_namespace
,
project:
project
)
}
let_it_be
(
:project_namespace
)
{
project
.
project_namespace
}
it
'does not include project_namespaces in the count of subgroups'
do
expect
(
found_group
.
preloaded_subgroup_count
).
to
eq
(
3
)
...
...
spec/services/groups/transfer_service_spec.rb
View file @
dbcd6df7
...
...
@@ -253,14 +253,18 @@ RSpec.describe Groups::TransferService, :sidekiq_inline do
expect
(
transfer_service
.
error
).
to
eq
(
'Transfer failed: The parent group already has a subgroup or a project with the same path.'
)
end
context
'with project namespace'
do
# currently when a project is created it gets a corresponding project namespace
# so we test the case where a project without a project namespace is transferred
# for backward compatibility
context
'without project namespace'
do
before
do
project_namespace
=
project
.
project_namespace
project
.
update
!
(
project_namespace_id:
nil
)
project_namespace
.
de
stroy!
project
.
update
_column
(
:project_namespace_id
,
nil
)
project_namespace
.
de
lete
end
it
'adds an error on group'
do
expect
(
project
.
reload
.
project_namespace
).
to
be_nil
expect
(
transfer_service
.
execute
(
new_parent_group
)).
to
be_falsy
expect
(
transfer_service
.
error
).
to
eq
(
'Transfer failed: Validation failed: Group URL has already been taken'
)
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