Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in / Register
Toggle navigation
quey.org
Project
Project
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
quey.org
quey.org
Commits
b5f7e128
Unverified
Commit
b5f7e128
authored
Oct 09, 2019
by
Eugen Rochko
Committed by
GitHub
Oct 09, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove auto-silence behaviour from spam check (#12117)
Fix #12113
parent
354fdd31
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
12 deletions
+15
-12
app/lib/spam_check.rb
app/lib/spam_check.rb
+1
-6
app/models/account.rb
app/models/account.rb
+1
-1
app/models/admin/account_action.rb
app/models/admin/account_action.rb
+12
-0
config/locales/en.yml
config/locales/en.yml
+1
-1
spec/lib/spam_check_spec.rb
spec/lib/spam_check_spec.rb
+0
-4
No files found.
app/lib/spam_check.rb
View file @
b5f7e128
...
...
@@ -44,7 +44,6 @@ class SpamCheck
end
def
flag!
auto_silence_account!
auto_report_status!
end
...
...
@@ -134,17 +133,13 @@ class SpamCheck
text
.
gsub
(
/\s+/
,
' '
).
strip
end
def
auto_silence_account!
@account
.
silence!
end
def
auto_report_status!
status_ids
=
Status
.
where
(
visibility:
%i(public unlisted)
).
where
(
id:
matching_status_ids
).
pluck
(
:id
)
+
[
@status
.
id
]
if
@status
.
distributable?
ReportService
.
new
.
call
(
Account
.
representative
,
@account
,
status_ids:
status_ids
,
comment:
I18n
.
t
(
'spam_check.spam_detected_and_silenced'
))
end
def
already_flagged?
@account
.
silenced?
@account
.
silenced?
||
@account
.
targeted_reports
.
unresolved
.
where
(
account_id:
-
99
).
exists?
end
def
trusted?
...
...
app/models/account.rb
View file @
b5f7e128
...
...
@@ -198,7 +198,7 @@ class Account < ApplicationRecord
end
def
unsilence!
update!
(
silenced_at:
nil
,
trust_level:
trust_level
==
TRUST_LEVELS
[
:untrusted
]
?
TRUST_LEVELS
[:
trusted
]
:
trust_level
)
update!
(
silenced_at:
nil
)
end
def
suspended?
...
...
app/models/admin/account_action.rb
View file @
b5f7e128
...
...
@@ -62,6 +62,8 @@ class Admin::AccountAction
def
process_action!
case
type
when
'none'
handle_resolve!
when
'disable'
handle_disable!
when
'silence'
...
...
@@ -103,6 +105,16 @@ 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
)
...
...
config/locales/en.yml
View file @
b5f7e128
...
...
@@ -497,7 +497,7 @@ en:
title
:
Custom terms of service
site_title
:
Server name
spam_check_enabled
:
desc_html
:
Mastodon can auto-
silence and auto-
report accounts that send repeated unsolicited messages. There may be
false
positives.
desc_html
:
Mastodon can auto-report accounts that send repeated unsolicited messages. There may be
false
positives.
title
:
Anti-spam automation
thumbnail
:
desc_html
:
Used for previews via OpenGraph and API. 1200x630px recommended
...
...
spec/lib/spam_check_spec.rb
View file @
b5f7e128
...
...
@@ -181,10 +181,6 @@ RSpec.describe SpamCheck do
described_class
.
new
(
status2
).
flag!
end
it
'silences the account'
do
expect
(
sender
.
silenced?
).
to
be
true
end
it
'creates a report about the account'
do
expect
(
sender
.
targeted_reports
.
unresolved
.
count
).
to
eq
1
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