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
98f0094f
Commit
98f0094f
authored
Jun 05, 2017
by
Athar Hameed
Committed by
Douwe Maan
Jun 05, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update mirror user for all projects deleted user is mirror_user for
parent
970f41cf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
0 deletions
+28
-0
app/services/users/destroy_service.rb
app/services/users/destroy_service.rb
+6
-0
changelogs/unreleased-ee/2532-saving-a-mirrored-project-errors-out-if-mirror-user-has-been-deleted.yml
...ed-project-errors-out-if-mirror-user-has-been-deleted.yml
+4
-0
spec/services/users/destroy_service_spec.rb
spec/services/users/destroy_service_spec.rb
+18
-0
No files found.
app/services/users/destroy_service.rb
View file @
98f0094f
...
...
@@ -26,6 +26,12 @@ module Users
::
Projects
::
DestroyService
.
new
(
project
,
current_user
,
skip_repo:
true
).
execute
end
Project
.
includes
(
group: :owners
).
where
(
mirror_user:
user
).
find_each
do
|
project
|
if
project
.
group
.
present?
project
.
update
(
mirror_user:
project
.
group
.
owners
.
first
)
end
end
MigrateToGhostUserService
.
new
(
user
).
execute
unless
options
[
:hard_delete
]
# Destroy the namespace after destroying the user since certain methods may depend on the namespace existing
...
...
changelogs/unreleased-ee/2532-saving-a-mirrored-project-errors-out-if-mirror-user-has-been-deleted.yml
0 → 100644
View file @
98f0094f
---
title
:
Update mirror_user for project when mirror_user is deleted
merge_request
:
2013
author
:
Athar Hameed
spec/services/users/destroy_service_spec.rb
View file @
98f0094f
...
...
@@ -159,5 +159,23 @@ describe Users::DestroyService, services: true do
service
.
execute
(
user
,
hard_delete:
true
)
end
end
context
"when the user was the mirror_user for a group project"
do
let
(
:group_owner
)
{
create
(
:user
)
}
let
(
:mirror_user
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
)
}
before
do
group
.
add_owner
(
group_owner
)
group
.
add_master
(
mirror_user
)
end
it
'updates the mirror_user to one of the group owners'
do
project
=
create
(
:empty_project
,
namespace_id:
group
.
id
,
creator:
group_owner
,
mirror_user:
mirror_user
)
service
.
execute
(
mirror_user
)
expect
(
project
.
reload
.
mirror_user
).
to
eq
group_owner
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