about summary refs log tree commit diff
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2020-03-08 12:38:00 -0500
committermultiple creatures <dev@multiple-creature.party>2020-03-08 12:38:00 -0500
commitca1052059372027d05a6133b95176b40954355d7 (patch)
treeb861b2cbda14cd47e2b2080529c6b4b587f4a0f4
parent5dd65e0c6fdd8623af09f545991fb5995fe916c1 (diff)
add option to auto-trust accounts (at the time of processing a create note) from servers that don't have a graylist policy set on them
-rw-r--r--app/lib/activitypub/activity/create.rb6
-rw-r--r--app/models/form/admin_settings.rb2
-rw-r--r--app/views/admin/settings/edit.html.haml1
-rw-r--r--config/locales/en.yml1
-rw-r--r--config/settings.yml1
5 files changed, 10 insertions, 1 deletions
diff --git a/app/lib/activitypub/activity/create.rb b/app/lib/activitypub/activity/create.rb
index 8fd429059..2c101c6cb 100644
--- a/app/lib/activitypub/activity/create.rb
+++ b/app/lib/activitypub/activity/create.rb
@@ -6,7 +6,11 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
 
     unless known?
       if @options[:announced_by].nil?
-        return reject_payload! if !@options[:requested] && rejecting_unknown?
+        if rejecting_unknown?
+          return reject_payload! if !@options[:requested]
+        elsif !@account.manual_only? && Setting.auto_mark_known && Setting.mark_known_from_posts
+          @account.mark_known!
+        end
       elsif !@account.manual_only? && Setting.auto_mark_known && Setting.mark_known_from_boosts && known?(@options[:announced_by])
         @account.mark_known!
       else
diff --git a/app/models/form/admin_settings.rb b/app/models/form/admin_settings.rb
index 7e68196a7..fa3eabf88 100644
--- a/app/models/form/admin_settings.rb
+++ b/app/models/form/admin_settings.rb
@@ -37,6 +37,7 @@ class Form::AdminSettings
     auto_mark_instance_actors_known
     auto_mark_services_known
     always_mark_instance_actors_known
+    mark_known_from_posts
     mark_known_from_follows
     mark_known_from_mentions
     mark_known_from_boosts
@@ -65,6 +66,7 @@ class Form::AdminSettings
     always_mark_instance_actors_known
     werewolf_status
     spam_check_enabled
+    mark_known_from_posts
     mark_known_from_follows
     mark_known_from_mentions
     mark_known_from_boosts
diff --git a/app/views/admin/settings/edit.html.haml b/app/views/admin/settings/edit.html.haml
index 8e58215ca..bfb7d1cfe 100644
--- a/app/views/admin/settings/edit.html.haml
+++ b/app/views/admin/settings/edit.html.haml
@@ -50,6 +50,7 @@
       = f.input :auto_mark_instance_actors_known, as: :boolean, wrapper: :with_label, label: t('admin.settings.auto_mark_instance_actors_known.title'), hint: t('admin.settings.auto_mark_instance_actors_known.desc_html')
       = f.input :always_mark_instance_actors_known, as: :boolean, wrapper: :with_label, label: t('admin.settings.always_mark_instance_actors_known.title'), hint: t('admin.settings.always_mark_instance_actors_known.desc_html')
     .fields-row__column.fields-row__column-6.fields-group
+      = f.input :mark_known_from_posts, as: :boolean, wrapper: :with_label, label: t('admin.settings.mark_known_from.posts')
       = f.input :mark_known_from_follows, as: :boolean, wrapper: :with_label, label: t('admin.settings.mark_known_from.follows')
       = f.input :mark_known_from_mentions, as: :boolean, wrapper: :with_label, label: t('admin.settings.mark_known_from.mentions')
       = f.input :mark_known_from_boosts, as: :boolean, wrapper: :with_label, label: t('admin.settings.mark_known_from.boosts')
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 573c44c7f..68dc80ef4 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -550,6 +550,7 @@ en:
         desc_html: Always allow server actor accounts to fetch resources from this server.  <strong>Will make restricted mode less effective.</strong>
         title: Always trust server actors
       mark_known_from:
+        posts: Trust new peers when receiving posts from unrestricted servers
         follows: Trust new peers when someone joins their pack
         mentions: Trust new peers when they're mentioned locally
         boosts: Trust new peers whose roars are shared by known creatures
diff --git a/config/settings.yml b/config/settings.yml
index 95bae4127..42e15337d 100644
--- a/config/settings.yml
+++ b/config/settings.yml
@@ -71,6 +71,7 @@ defaults: &defaults
   auto_mark_instance_actors_known: true
   auto_mark_services_known: false
   always_mark_instance_actors_known: false
+  mark_known_from_posts: false
   mark_known_from_follows: true
   mark_known_from_mentions: true
   mark_known_from_boosts: true