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
8077a5f9
Commit
8077a5f9
authored
Mar 12, 2016
by
Zeger-Jan van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clearify who deletes the user
parent
a09323c9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
10 additions
and
9 deletions
+10
-9
CHANGELOG
CHANGELOG
+1
-1
app/controllers/admin/abuse_reports_controller.rb
app/controllers/admin/abuse_reports_controller.rb
+1
-1
app/models/abuse_report.rb
app/models/abuse_report.rb
+2
-2
app/services/delete_user_service.rb
app/services/delete_user_service.rb
+1
-1
spec/models/abuse_report_spec.rb
spec/models/abuse_report_spec.rb
+4
-3
spec/workers/delete_user_worker_spec.rb
spec/workers/delete_user_worker_spec.rb
+1
-1
No files found.
CHANGELOG
View file @
8077a5f9
...
...
@@ -39,6 +39,7 @@ v 8.6.0 (unreleased)
- Add ability to show archived projects on dashboard, explore and group pages
- Move group activity to separate page
- Continue parameters are checked to ensure redirection goes to the same instance
- User deletion is now done in the background so the request can not time out
v 8.5.6
- Obtain a lease before querying LDAP
...
...
@@ -60,7 +61,6 @@ v 8.5.3
- Show commit message in JIRA mention comment
- Makes issue page and merge request page usable on mobile browsers.
- Improved UI for profile settings
- User deletion is now done in the background so the request can not time out
v 8.5.2
- Fix sidebar overlapping content when screen width was below 1200px
...
...
app/controllers/admin/abuse_reports_controller.rb
View file @
8077a5f9
...
...
@@ -6,7 +6,7 @@ class Admin::AbuseReportsController < Admin::ApplicationController
def
destroy
abuse_report
=
AbuseReport
.
find
(
params
[
:id
])
abuse_report
.
remove_user
(
current_user
)
if
params
[
:remove_user
]
abuse_report
.
remove_user
(
deleted_by:
current_user
)
if
params
[
:remove_user
]
abuse_report
.
destroy
render
nothing:
true
...
...
app/models/abuse_report.rb
View file @
8077a5f9
...
...
@@ -19,9 +19,9 @@ class AbuseReport < ActiveRecord::Base
validates
:message
,
presence:
true
validates
:user_id
,
uniqueness:
{
message:
'has already been reported'
}
def
remove_user
(
current_user
)
def
remove_user
(
deleted_by
:
)
user
.
block
DeleteUserWorker
.
perform_async
(
current_user
.
id
,
user
.
id
,
force
:
true
)
DeleteUserWorker
.
perform_async
(
deleted_by
.
id
,
user
.
id
,
delete_solo_owned_groups
:
true
)
end
def
notify
...
...
app/services/delete_user_service.rb
View file @
8077a5f9
...
...
@@ -6,7 +6,7 @@ class DeleteUserService
end
def
execute
(
user
,
options
=
{})
if
!
options
[
:
force
]
&&
user
.
solo_owned_groups
.
present?
if
!
options
[
:
delete_solo_owned_groups
]
&&
user
.
solo_owned_groups
.
present?
user
.
errors
[
:base
]
<<
'You must transfer ownership or delete groups before you can remove user'
return
user
end
...
...
spec/models/abuse_report_spec.rb
View file @
8077a5f9
...
...
@@ -32,13 +32,14 @@ RSpec.describe AbuseReport, type: :model do
describe
'#remove_user'
do
it
'blocks the user'
do
expect
{
subject
.
remove_user
(
user
)
}.
to
change
{
subject
.
user
.
blocked?
}.
to
(
true
)
expect
{
subject
.
remove_user
(
deleted_by:
user
)
}.
to
change
{
subject
.
user
.
blocked?
}.
to
(
true
)
end
it
'lets a worker delete the user'
do
expect
(
DeleteUserWorker
).
to
receive
(
:perform_async
).
with
(
user
.
id
,
subject
.
user
.
id
,
force:
true
)
expect
(
DeleteUserWorker
).
to
receive
(
:perform_async
).
with
(
user
.
id
,
subject
.
user
.
id
,
delete_solo_owned_groups:
true
)
subject
.
remove_user
(
user
)
subject
.
remove_user
(
deleted_by:
user
)
end
end
...
...
spec/workers/delete_user_worker_spec.rb
View file @
8077a5f9
...
...
@@ -43,7 +43,7 @@ describe DeleteUserWorker do
before
do
solo_owned
.
group_members
=
[
member
]
DeleteUserWorker
.
new
.
perform
(
current_user
.
id
,
user
.
id
,
"
force
"
=>
true
)
DeleteUserWorker
.
new
.
perform
(
current_user
.
id
,
user
.
id
,
"
delete_solo_owned_groups
"
=>
true
)
end
it
'deletes solo owned groups'
do
...
...
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