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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
f09b7f56
Commit
f09b7f56
authored
Jun 02, 2017
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support hard deletion in Admin::UsersController#destroy
parent
158581a4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
4 deletions
+16
-4
app/controllers/admin/users_controller.rb
app/controllers/admin/users_controller.rb
+1
-1
doc/user/profile/account/delete_account.md
doc/user/profile/account/delete_account.md
+2
-1
spec/controllers/admin/users_controller_spec.rb
spec/controllers/admin/users_controller_spec.rb
+13
-2
No files found.
app/controllers/admin/users_controller.rb
View file @
f09b7f56
...
@@ -138,7 +138,7 @@ class Admin::UsersController < Admin::ApplicationController
...
@@ -138,7 +138,7 @@ class Admin::UsersController < Admin::ApplicationController
end
end
def
destroy
def
destroy
DeleteUserWorker
.
perform_async
(
current_user
.
id
,
user
.
id
)
user
.
delete_async
(
deleted_by:
current_user
,
params:
params
.
permit
(
:hard_delete
)
)
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
{
redirect_to
admin_users_path
,
notice:
"The user is being deleted."
}
format
.
html
{
redirect_to
admin_users_path
,
notice:
"The user is being deleted."
}
...
...
doc/user/profile/account/delete_account.md
View file @
f09b7f56
...
@@ -25,7 +25,8 @@ Instead of being deleted, these records will be moved to a system-wide
...
@@ -25,7 +25,8 @@ Instead of being deleted, these records will be moved to a system-wide
When a user is deleted from an abuse report or spam log, these associated
When a user is deleted from an abuse report or spam log, these associated
records are not ghosted and will be removed, along with any groups the user
records are not ghosted and will be removed, along with any groups the user
is a sole owner of. Administrators can also request this behaviour when
is a sole owner of. Administrators can also request this behaviour when
deleting users from the
[
API
](
../../../api/users.md#user-deletion
)
deleting users from the
[
API
](
../../../api/users.md#user-deletion
)
or the
admin area.
[
ce-7393
]:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7393
[
ce-7393
]:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7393
[
ce-10273
]:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/10273
[
ce-10273
]:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/10273
...
...
spec/controllers/admin/users_controller_spec.rb
View file @
f09b7f56
...
@@ -10,15 +10,26 @@ describe Admin::UsersController do
...
@@ -10,15 +10,26 @@ describe Admin::UsersController do
describe
'DELETE #user with projects'
do
describe
'DELETE #user with projects'
do
let
(
:project
)
{
create
(
:empty_project
,
namespace:
user
.
namespace
)
}
let
(
:project
)
{
create
(
:empty_project
,
namespace:
user
.
namespace
)
}
let!
(
:issue
)
{
create
(
:issue
,
author:
user
)
}
before
do
before
do
project
.
team
<<
[
user
,
:developer
]
project
.
team
<<
[
user
,
:developer
]
end
end
it
'deletes user'
do
it
'deletes user
and ghosts their contributions
'
do
delete
:destroy
,
id:
user
.
username
,
format: :json
delete
:destroy
,
id:
user
.
username
,
format: :json
expect
(
response
).
to
have_http_status
(
200
)
expect
(
User
.
exists?
(
user
.
id
)).
to
be_falsy
expect
(
issue
.
reload
.
author
).
to
be_ghost
end
it
'deletes the user and their contributions when hard delete is specified'
do
delete
:destroy
,
id:
user
.
username
,
hard_delete:
true
,
format: :json
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
expect
{
User
.
find
(
user
.
id
)
}.
to
raise_exception
(
ActiveRecord
::
RecordNotFound
)
expect
(
User
.
exists?
(
user
.
id
)).
to
be_falsy
expect
(
Issue
.
exists?
(
issue
.
id
)).
to
be_falsy
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