Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mastodon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pierre Boudes
mastodon
Commits
61f35c1a
Unverified
Commit
61f35c1a
authored
5 years ago
by
ThibG
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix reported accounts not being whitelisted when resolving a spamcheck report (#13289)
parent
c39ad4ab
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/models/admin/account_action.rb
+0
-12
0 additions, 12 deletions
app/models/admin/account_action.rb
app/models/report.rb
+8
-0
8 additions, 0 deletions
app/models/report.rb
spec/controllers/admin/reports_controller_spec.rb
+20
-0
20 additions, 0 deletions
spec/controllers/admin/reports_controller_spec.rb
with
28 additions
and
12 deletions
app/models/admin/account_action.rb
+
0
−
12
View file @
61f35c1a
...
...
@@ -62,8 +62,6 @@ class Admin::AccountAction
def
process_action!
case
type
when
'none'
handle_resolve!
when
'disable'
handle_disable!
when
'silence'
...
...
@@ -105,16 +103,6 @@ class Admin::AccountAction
end
end
def
handle_resolve!
if
with_report?
&&
report
.
account_id
==
-
99
&&
target_account
.
trust_level
==
Account
::
TRUST_LEVELS
[
:untrusted
]
# This is an automated report and it is being dismissed, so it's
# a false positive, in which case update the account's trust level
# to prevent further spam checks
target_account
.
update
(
trust_level:
Account
::
TRUST_LEVELS
[
:trusted
])
end
end
def
handle_disable!
authorize
(
target_account
.
user
,
:disable?
)
log_action
(
:disable
,
target_account
.
user
)
...
...
This diff is collapsed.
Click to expand it.
app/models/report.rb
+
8
−
0
View file @
61f35c1a
...
...
@@ -59,6 +59,14 @@ class Report < ApplicationRecord
end
def
resolve!
(
acting_account
)
if
account_id
==
-
99
&&
target_account
.
trust_level
==
Account
::
TRUST_LEVELS
[
:untrusted
]
# This is an automated report and it is being dismissed, so it's
# a false positive, in which case update the account's trust level
# to prevent further spam checks
target_account
.
update
(
trust_level:
Account
::
TRUST_LEVELS
[
:trusted
])
end
RemovalWorker
.
push_bulk
(
Status
.
with_discarded
.
discarded
.
where
(
id:
status_ids
).
pluck
(
:id
))
{
|
status_id
|
[
status_id
,
{
immediate:
true
}]
}
update!
(
action_taken:
true
,
action_taken_by_account_id:
acting_account
.
id
)
end
...
...
This diff is collapsed.
Click to expand it.
spec/controllers/admin/reports_controller_spec.rb
+
20
−
0
View file @
61f35c1a
...
...
@@ -46,6 +46,26 @@ describe Admin::ReportsController do
end
end
describe
'POST #resolve'
do
it
'resolves the report'
do
report
=
Fabricate
(
:report
)
put
:resolve
,
params:
{
id:
report
}
expect
(
response
).
to
redirect_to
(
admin_reports_path
)
report
.
reload
expect
(
report
.
action_taken_by_account
).
to
eq
user
.
account
expect
(
report
.
action_taken
).
to
eq
true
end
it
'sets trust level when the report is an antispam one'
do
report
=
Fabricate
(
:report
,
account:
Account
.
representative
)
put
:resolve
,
params:
{
id:
report
}
report
.
reload
expect
(
report
.
target_account
.
trust_level
).
to
eq
Account
::
TRUST_LEVELS
[
:trusted
]
end
end
describe
'POST #reopen'
do
it
'reopens the report'
do
report
=
Fabricate
(
:report
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment