BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
60eee739
Commit
60eee739
authored
Apr 16, 2017
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hard delete users' associated records deleted from AbuseReports
In the case of spammers, we really want a hard delete to avoid retaining spam. Closes #31021
parent
309bab43
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
3 deletions
+10
-3
abuse_report.rb
app/models/abuse_report.rb
+1
-1
destroy_service.rb
app/services/users/destroy_service.rb
+1
-1
abuse_report_spec.rb
spec/models/abuse_report_spec.rb
+2
-1
destroy_service_spec.rb
spec/services/users/destroy_service_spec.rb
+6
-0
No files found.
app/models/abuse_report.rb
View file @
60eee739
...
...
@@ -16,7 +16,7 @@ class AbuseReport < ActiveRecord::Base
def
remove_user
(
deleted_by
:)
user
.
block
DeleteUserWorker
.
perform_async
(
deleted_by
.
id
,
user
.
id
,
delete_solo_owned_groups:
true
)
DeleteUserWorker
.
perform_async
(
deleted_by
.
id
,
user
.
id
,
delete_solo_owned_groups:
true
,
hard_delete:
true
)
end
def
notify
...
...
app/services/users/destroy_service.rb
View file @
60eee739
...
...
@@ -26,7 +26,7 @@ module Users
::
Projects
::
DestroyService
.
new
(
project
,
current_user
,
skip_repo:
true
).
execute
end
MigrateToGhostUserService
.
new
(
user
).
execute
MigrateToGhostUserService
.
new
(
user
).
execute
unless
options
[
:hard_delete
]
# Destroy the namespace after destroying the user since certain methods may depend on the namespace existing
namespace
=
user
.
namespace
...
...
spec/models/abuse_report_spec.rb
View file @
60eee739
...
...
@@ -29,7 +29,8 @@ RSpec.describe AbuseReport, type: :model do
it
'lets a worker delete the user'
do
expect
(
DeleteUserWorker
).
to
receive
(
:perform_async
).
with
(
user
.
id
,
subject
.
user
.
id
,
delete_solo_owned_groups:
true
)
delete_solo_owned_groups:
true
,
hard_delete:
true
)
subject
.
remove_user
(
deleted_by:
user
)
end
...
...
spec/services/users/destroy_service_spec.rb
View file @
60eee739
...
...
@@ -152,6 +152,12 @@ describe Users::DestroyService, services: true do
service
.
execute
(
user
)
end
it
'does not run `MigrateToGhostUser` if hard_delete option is given'
do
expect_any_instance_of
(
Users
::
MigrateToGhostUserService
).
not_to
receive
(
:execute
)
service
.
execute
(
user
,
hard_delete:
true
)
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