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
iv
gitlab-ce
Commits
4bcc0977
Commit
4bcc0977
authored
Feb 17, 2016
by
Zeger-Jan van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A worker deletes a user, so the request doesn't time out
Fixes #13261
parent
bc590ce6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
1 deletion
+34
-1
CHANGELOG
CHANGELOG
+1
-0
app/controllers/admin/users_controller.rb
app/controllers/admin/users_controller.rb
+1
-1
app/workers/delete_user_worker.rb
app/workers/delete_user_worker.rb
+10
-0
spec/workers/delete_user_worker_spec.rb
spec/workers/delete_user_worker_spec.rb
+22
-0
No files found.
CHANGELOG
View file @
4bcc0977
...
@@ -178,6 +178,7 @@ v 8.5.0
...
@@ -178,6 +178,7 @@ v 8.5.0
v 8.4.5
v 8.4.5
- No CE-specific changes
- No CE-specific changes
- User deletion is now done in the background so the request can not time out
v 8.4.4
v 8.4.4
- Update omniauth-saml gem to 1.4.2
- Update omniauth-saml gem to 1.4.2
...
...
app/controllers/admin/users_controller.rb
View file @
4bcc0977
...
@@ -122,7 +122,7 @@ class Admin::UsersController < Admin::ApplicationController
...
@@ -122,7 +122,7 @@ class Admin::UsersController < Admin::ApplicationController
DeleteUserService
.
new
(
current_user
).
execute
(
user
)
DeleteUserService
.
new
(
current_user
).
execute
(
user
)
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
{
redirect_to
admin_users_path
}
format
.
html
{
redirect_to
admin_users_path
,
notice:
"The user is being deleted."
}
format
.
json
{
head
:ok
}
format
.
json
{
head
:ok
}
end
end
end
end
...
...
app/workers/delete_user_worker.rb
0 → 100644
View file @
4bcc0977
class
DeleteUserWorker
include
Sidekiq
::
Worker
def
perform
(
current_user_id
,
delete_user_id
)
delete_user
=
User
.
find
(
delete_user_id
)
current_user
=
User
.
find
(
current_user_id
)
DeleteUserService
.
new
(
current_user
).
execute
(
delete_user
)
end
end
spec/workers/delete_user_worker_spec.rb
0 → 100644
View file @
4bcc0977
require
'spec_helper'
describe
DeleteUserWorker
do
describe
"Deletes a user and all their personal projects"
do
let!
(
:user
)
{
create
(
:user
)
}
let!
(
:current_user
)
{
create
(
:user
)
}
let!
(
:namespace
)
{
create
(
:namespace
,
owner:
user
)
}
let!
(
:project
)
{
create
(
:project
,
namespace:
namespace
)
}
before
do
DeleteUserWorker
.
new
.
perform
(
current_user
.
id
,
user
.
id
)
end
it
'deletes all personal projects'
do
expect
{
Project
.
find
(
project
.
id
)
}.
to
raise_error
(
ActiveRecord
::
RecordNotFound
)
end
it
'deletes the user'
do
expect
{
User
.
find
(
user
.
id
)
}.
to
raise_error
(
ActiveRecord
::
RecordNotFound
)
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