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
72d3dcf6
Commit
72d3dcf6
authored
Feb 20, 2022
by
Serena Fang
Committed by
charlie ablett
Feb 20, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return project delete errors
If group deletion fails, return failure reason. Changelog: changed
parent
b236eb2c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
0 deletions
+15
-0
app/services/groups/destroy_service.rb
app/services/groups/destroy_service.rb
+4
-0
spec/services/groups/destroy_service_spec.rb
spec/services/groups/destroy_service_spec.rb
+11
-0
No files found.
app/services/groups/destroy_service.rb
View file @
72d3dcf6
...
...
@@ -11,11 +11,15 @@ module Groups
# rubocop: disable CodeReuse/ActiveRecord
def
execute
# TODO - add a policy check here https://gitlab.com/gitlab-org/gitlab/-/issues/353082
raise
DestroyError
,
"You can't delete this group because you're blocked."
if
current_user
.
blocked?
group
.
prepare_for_destroy
group
.
projects
.
includes
(
:project_feature
).
each
do
|
project
|
# Execute the destruction of the models immediately to ensure atomic cleanup.
success
=
::
Projects
::
DestroyService
.
new
(
project
,
current_user
).
execute
raise
DestroyError
,
"Project
#{
project
.
id
}
can't be deleted"
unless
success
end
...
...
spec/services/groups/destroy_service_spec.rb
View file @
72d3dcf6
...
...
@@ -112,6 +112,17 @@ RSpec.describe Groups::DestroyService do
end
end
context
'when group owner is blocked'
do
before
do
user
.
block!
end
it
'returns a more descriptive error message'
do
expect
{
destroy_group
(
group
,
user
,
false
)
}
.
to
raise_error
(
Groups
::
DestroyService
::
DestroyError
,
"You can't delete this group because you're blocked."
)
end
end
describe
'repository removal'
do
before
do
destroy_group
(
group
,
user
,
false
)
...
...
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