Add setting to disable the anti-spam (#11296)

* Add environment variable to disable the anti-spam

* Move antispam setting to admin settings

* Fix typo

* antispam → spam_check
This commit is contained in:
ThibG 2019-07-17 21:09:15 +02:00 committed by Eugen Rochko
parent fccd25cf53
commit 7e2b6da57f
7 changed files with 18 additions and 1 deletions

View File

@ -30,6 +30,7 @@ module Admin
@trending_hashtags = TrendingTags.get(7) @trending_hashtags = TrendingTags.get(7)
@profile_directory = Setting.profile_directory @profile_directory = Setting.profile_directory
@timeline_preview = Setting.timeline_preview @timeline_preview = Setting.timeline_preview
@spam_check_enabled = Setting.spam_check_enabled
end end
private private

View File

@ -14,7 +14,7 @@ class SpamCheck
end end
def skip? def skip?
already_flagged? || trusted? || no_unsolicited_mentions? || solicited_reply? disabled? || already_flagged? || trusted? || no_unsolicited_mentions? || solicited_reply?
end end
def spam? def spam?
@ -80,6 +80,10 @@ class SpamCheck
private private
def disabled?
!Setting.spam_check_enabled
end
def remove_mentions(text) def remove_mentions(text)
return text.gsub(Account::MENTION_RE, '') if @status.local? return text.gsub(Account::MENTION_RE, '') if @status.local?

View File

@ -28,6 +28,7 @@ class Form::AdminSettings
thumbnail thumbnail
hero hero
mascot mascot
spam_check_enabled
).freeze ).freeze
BOOLEAN_KEYS = %i( BOOLEAN_KEYS = %i(
@ -39,6 +40,7 @@ class Form::AdminSettings
show_known_fediverse_at_about_page show_known_fediverse_at_about_page
preview_sensitive_media preview_sensitive_media
profile_directory profile_directory
spam_check_enabled
).freeze ).freeze
UPLOAD_KEYS = %i( UPLOAD_KEYS = %i(

View File

@ -51,6 +51,8 @@
= feature_hint(link_to(t('admin.dashboard.feature_timeline_preview'), edit_admin_settings_path), @timeline_preview) = feature_hint(link_to(t('admin.dashboard.feature_timeline_preview'), edit_admin_settings_path), @timeline_preview)
%li %li
= feature_hint(link_to(t('admin.dashboard.feature_relay'), admin_relays_path), @relay_enabled) = feature_hint(link_to(t('admin.dashboard.feature_relay'), admin_relays_path), @relay_enabled)
%li
= feature_hint(link_to(t('admin.dashboard.feature_spam_check'), edit_admin_settings_path), @spam_check_enabled)
.dashboard__widgets__versions .dashboard__widgets__versions
%div %div

View File

@ -66,6 +66,9 @@
.fields-group .fields-group
= f.input :profile_directory, as: :boolean, wrapper: :with_label, label: t('admin.settings.profile_directory.title'), hint: t('admin.settings.profile_directory.desc_html') = f.input :profile_directory, as: :boolean, wrapper: :with_label, label: t('admin.settings.profile_directory.title'), hint: t('admin.settings.profile_directory.desc_html')
.fields-group
= f.input :spam_check_enabled, as: :boolean, wrapper: :with_label, label: t('admin.settings.spam_check_enabled.title'), hint: t('admin.settings.spam_check_enabled.desc_html')
%hr.spacer/ %hr.spacer/
.fields-group .fields-group

View File

@ -250,6 +250,7 @@ en:
feature_profile_directory: Profile directory feature_profile_directory: Profile directory
feature_registrations: Registrations feature_registrations: Registrations
feature_relay: Federation relay feature_relay: Federation relay
feature_spam_check: Anti-spam
feature_timeline_preview: Timeline preview feature_timeline_preview: Timeline preview
features: Features features: Features
hidden_service: Federation with hidden services hidden_service: Federation with hidden services
@ -449,6 +450,9 @@ en:
desc_html: You can write your own privacy policy, terms of service or other legalese. You can use HTML tags desc_html: You can write your own privacy policy, terms of service or other legalese. You can use HTML tags
title: Custom terms of service title: Custom terms of service
site_title: Server name site_title: Server name
spam_check_enabled:
desc_html: Mastodon can auto-silence and auto-report accounts based on measures such as detecting accounts who send repeated unsolicited messages. There may be false positives.
title: Anti-spam
thumbnail: thumbnail:
desc_html: Used for previews via OpenGraph and API. 1200x630px recommended desc_html: Used for previews via OpenGraph and API. 1200x630px recommended
title: Server thumbnail title: Server thumbnail

View File

@ -61,6 +61,7 @@ defaults: &defaults
activity_api_enabled: true activity_api_enabled: true
peers_api_enabled: true peers_api_enabled: true
show_known_fediverse_at_about_page: true show_known_fediverse_at_about_page: true
spam_check_enabled: true
development: development:
<<: *defaults <<: *defaults