about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--app/lib/activitypub/activity/create.rb2
-rw-r--r--app/models/form/admin_settings.rb4
-rw-r--r--app/services/activitypub/process_account_service.rb2
-rw-r--r--app/services/favourite_service.rb2
-rw-r--r--app/services/follow_service.rb2
-rw-r--r--app/services/post_status_service.rb2
-rw-r--r--app/services/reblog_service.rb2
-rw-r--r--app/views/admin/settings/edit.html.haml6
-rw-r--r--config/locales/en.yml6
-rw-r--r--config/settings.yml2
10 files changed, 24 insertions, 6 deletions
diff --git a/app/lib/activitypub/activity/create.rb b/app/lib/activitypub/activity/create.rb
index e7fe19152..4367344ab 100644
--- a/app/lib/activitypub/activity/create.rb
+++ b/app/lib/activitypub/activity/create.rb
@@ -9,7 +9,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
       if @options[:announced_by].nil?
         return reject_payload! if !@options[:requested] && rejecting_unknown?
       else
-        @account.mark_known! if known?(@options[:announced_by])
+        @account.mark_known! if Setting.auto_mark_known && known?(@options[:announced_by])
       end
     end
 
diff --git a/app/models/form/admin_settings.rb b/app/models/form/admin_settings.rb
index 0e9bfb265..a2ea2489b 100644
--- a/app/models/form/admin_settings.rb
+++ b/app/models/form/admin_settings.rb
@@ -34,6 +34,8 @@ class Form::AdminSettings
     mascot
     show_reblogs_in_public_timelines
     show_replies_in_public_timelines
+    auto_reject_unknown
+    auto_mark_known
   ).freeze
 
   BOOLEAN_KEYS = %i(
@@ -49,6 +51,8 @@ class Form::AdminSettings
     enable_keybase
     show_reblogs_in_public_timelines
     show_replies_in_public_timelines
+    auto_reject_unknown
+    auto_mark_known
   ).freeze
 
   UPLOAD_KEYS = %i(
diff --git a/app/services/activitypub/process_account_service.rb b/app/services/activitypub/process_account_service.rb
index c1c643ff0..a1d508405 100644
--- a/app/services/activitypub/process_account_service.rb
+++ b/app/services/activitypub/process_account_service.rb
@@ -23,7 +23,7 @@ class ActivityPub::ProcessAccountService < BaseService
 
         is_new_account = @account.nil?
         if is_new_account
-          set_reject_unknown_policy
+          set_reject_unknown_policy if Setting.auto_reject_unknown
           create_account
         end
         update_account
diff --git a/app/services/favourite_service.rb b/app/services/favourite_service.rb
index cff4c37e0..788b3a620 100644
--- a/app/services/favourite_service.rb
+++ b/app/services/favourite_service.rb
@@ -16,7 +16,7 @@ class FavouriteService < BaseService
 
     favourite = Favourite.create!(account: account, status: status)
 
-    status.account.mark_known! unless status.account.known?
+    status.account.mark_known! unless !Setting.auto_mark_known || status.account.known?
 
     curate_status(status)
     create_notification(favourite) unless skip_notify
diff --git a/app/services/follow_service.rb b/app/services/follow_service.rb
index 776c4cb9b..1653253f5 100644
--- a/app/services/follow_service.rb
+++ b/app/services/follow_service.rb
@@ -14,7 +14,7 @@ class FollowService < BaseService
     raise ActiveRecord::RecordNotFound if target_account.nil? || target_account.id == source_account.id || target_account.suspended?
     raise Mastodon::NotPermittedError  if target_account.blocking?(source_account) || source_account.blocking?(target_account) || target_account.moved?
 
-    target_account.mark_known! unless target_account.known?
+    target_account.mark_known! unless !Setting.auto_mark_known || target_account.known?
 
     if source_account.following?(target_account)
       # We're already following this account, but we'll call follow! again to
diff --git a/app/services/post_status_service.rb b/app/services/post_status_service.rb
index e7c81309f..353c1ef82 100644
--- a/app/services/post_status_service.rb
+++ b/app/services/post_status_service.rb
@@ -95,7 +95,7 @@ class PostStatusService < BaseService
   end
 
   def mark_recipient_known
-    @in_reply_to.account.mark_known! unless @in_reply_to.account.known?
+    @in_reply_to.account.mark_known! unless !Setting.auto_mark_known || @in_reply_to.account.known?
   end
 
   def set_footer_from_i_am
diff --git a/app/services/reblog_service.rb b/app/services/reblog_service.rb
index 1e7d4f3ca..4e63caef8 100644
--- a/app/services/reblog_service.rb
+++ b/app/services/reblog_service.rb
@@ -17,7 +17,7 @@ class ReblogService < BaseService
     new_reblog = reblog.nil?
 
     if new_reblog
-      reblogged_status.account.mark_known! unless reblogged_status.account.known?
+      reblogged_status.account.mark_known! unless !Setting.auto_mark_known || reblogged_status.account.known?
 
       visibility = options[:visibility] || account.user&.setting_default_privacy
       visibility = reblogged_status.visibility if reblogged_status.hidden?
diff --git a/app/views/admin/settings/edit.html.haml b/app/views/admin/settings/edit.html.haml
index a8c9f6a58..80f76c3c5 100644
--- a/app/views/admin/settings/edit.html.haml
+++ b/app/views/admin/settings/edit.html.haml
@@ -42,6 +42,12 @@
 
   %hr.spacer/
 
+  = f.input :auto_reject_unknown, as: :boolean, wrapper: :with_label, label: t('admin.settings.auto_reject_unknown.title'), hint: t('admin.settings.auto_reject_unknown.desc_html')
+
+  = f.input :auto_mark_known, as: :boolean, wrapper: :with_label, label: t('admin.settings.auto_mark_known.title'), hint: t('admin.settings.auto_mark_known.desc_html')
+
+  %hr.spacer/
+
   .fields-group
     = f.input :timeline_preview, as: :boolean, wrapper: :with_label, label: t('admin.settings.timeline_preview.title'), hint: t('admin.settings.timeline_preview.desc_html')
 
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 53ce23e7c..934555da8 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -505,6 +505,12 @@ en:
       timeline_preview:
         desc_html: Display public timeline on landing page
         title: Timeline preview
+      auto_reject_unknown:
+        desc_html: Automatically reject unknown accounts from newly-federated servers.
+        title: Graylist federation mode
+      auto_mark_known:
+        desc_html: Learn known accounts from outgoing interactions and incoming repeats from packmates.
+        title: Auto-learn known accounts
       title: Site settings
     statuses:
       back_to_account: Back to account page
diff --git a/config/settings.yml b/config/settings.yml
index fc2233c9f..ac2cf63a0 100644
--- a/config/settings.yml
+++ b/config/settings.yml
@@ -65,6 +65,8 @@ defaults: &defaults
   show_reblogs_in_public_timelines: false
   show_replies_in_public_timelines: false
   default_content_type: 'text/x-bbcode+markdown'
+  auto_reject_unknown: true
+  auto_mark_known: true
 
 development:
   <<: *defaults