about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2020-02-14 17:37:31 -0600
committermultiple creatures <dev@multiple-creature.party>2020-02-14 17:37:31 -0600
commit92847646cff1effdf42eaa0819d836a663d428c4 (patch)
tree057d47ae953ec2102b65f25345663796a8bed1dc /app
parent4f7e76a1308cc35f97f47a9f42c197aeca9ee2de (diff)
add options to let admins customize how trusting or strict graylist federation should be
Diffstat (limited to 'app')
-rw-r--r--app/models/form/admin_settings.rb8
-rw-r--r--app/services/favourite_service.rb1
-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.haml18
6 files changed, 23 insertions, 10 deletions
diff --git a/app/models/form/admin_settings.rb b/app/models/form/admin_settings.rb
index 359271e5d..f5006c3e3 100644
--- a/app/models/form/admin_settings.rb
+++ b/app/models/form/admin_settings.rb
@@ -40,6 +40,10 @@ class Form::AdminSettings
     always_mark_instance_actors_known
     werewolf_status
     spam_check_enabled
+    mark_known_from_follows
+    mark_known_from_mentions
+    mark_known_from_boosts
+    mark_known_from_favourites
   ).freeze
 
   BOOLEAN_KEYS = %i(
@@ -61,6 +65,10 @@ class Form::AdminSettings
     always_mark_instance_actors_known
     werewolf_status
     spam_check_enabled
+    mark_known_from_follows
+    mark_known_from_mentions
+    mark_known_from_boosts
+    mark_known_from_favourites
   ).freeze
 
   UPLOAD_KEYS = %i(
diff --git a/app/services/favourite_service.rb b/app/services/favourite_service.rb
index 9ab628fb0..aeac9728b 100644
--- a/app/services/favourite_service.rb
+++ b/app/services/favourite_service.rb
@@ -15,6 +15,7 @@ class FavouriteService < BaseService
 
     return favourite unless favourite.nil?
 
+    account.mark_known! unless !Setting.auto_mark_known || !Setting.mark_known_from_favourites || account.known?
     favourite = Favourite.create!(account: account, status: status)
 
     curate_status(status)
diff --git a/app/services/follow_service.rb b/app/services/follow_service.rb
index 7b714bfb2..1d9f1c726 100644
--- a/app/services/follow_service.rb
+++ b/app/services/follow_service.rb
@@ -15,7 +15,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 !Setting.auto_mark_known || target_account.known?
+    target_account.mark_known! unless !Setting.auto_mark_known || !Setting.mark_known_from_follows || target_account.known?
 
     SyncRemoteAccountWorker.perform_async(target_account.id) unless target_account.local? || target_account.passive_relationships.exists?
 
diff --git a/app/services/post_status_service.rb b/app/services/post_status_service.rb
index 274c2c297..3505dc536 100644
--- a/app/services/post_status_service.rb
+++ b/app/services/post_status_service.rb
@@ -102,7 +102,7 @@ class PostStatusService < BaseService
   end
 
   def mark_recipient_known
-    @in_reply_to.account.mark_known! unless !Setting.auto_mark_known || @in_reply_to.account.known?
+    @in_reply_to.account.mark_known! unless !Setting.auto_mark_known || !Setting.mark_known_from_mentions || @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 29dcbaf7c..4b7002fca 100644
--- a/app/services/reblog_service.rb
+++ b/app/services/reblog_service.rb
@@ -18,7 +18,7 @@ class ReblogService < BaseService
     new_reblog = reblog.nil?
 
     if new_reblog
-      reblogged_status.account.mark_known! unless !Setting.auto_mark_known || reblogged_status.account.known?
+      reblogged_status.account.mark_known! unless !Setting.auto_mark_known || !Setting.mark_known_from_boosts || reblogged_status.account.known?
       reblogged_status.touch if reblogged_status.account.id == account.id
 
       visibility = options[:visibility] || account.user&.setting_default_privacy
diff --git a/app/views/admin/settings/edit.html.haml b/app/views/admin/settings/edit.html.haml
index 2203c8275..032188db3 100644
--- a/app/views/admin/settings/edit.html.haml
+++ b/app/views/admin/settings/edit.html.haml
@@ -42,13 +42,17 @@
 
   %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')
-
-  = 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
+    .fields-row__column.fields-row__column-6.fields-group
+      = 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')
+      = 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_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')
+      = f.input :mark_known_from_favourites, as: :boolean, wrapper: :with_label, label: t('admin.settings.mark_known_from.favourites')
 
   %hr.spacer/