about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/lib/activitypub/activity.rb3
-rw-r--r--app/models/account.rb8
-rw-r--r--app/models/form/admin_settings.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.haml1
8 files changed, 17 insertions, 5 deletions
diff --git a/app/lib/activitypub/activity.rb b/app/lib/activitypub/activity.rb
index 30c854eda..27918883f 100644
--- a/app/lib/activitypub/activity.rb
+++ b/app/lib/activitypub/activity.rb
@@ -191,7 +191,8 @@ class ActivityPub::Activity
   def known?(account = nil)
     account = @account if account.nil?
     return true if account.known?
-    account.passive_relationships.exists?
+
+    !account.service? && account.passive_relationships.exists?
   end
 
   def reject_payload!
diff --git a/app/models/account.rb b/app/models/account.rb
index ca298f5d8..a2fa60a83 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -474,6 +474,14 @@ class Account < ApplicationRecord
     target_account.following?(self) || ever_mentioned_by?(target_account)
   end
 
+  def service?
+    @_is_service ||= actor_type == "Application" || actor_type == "Service" || username == "relay" || username == domain
+  end
+
+  def can_be_marked_known?
+    !known && (!service || (service? && Setting.auto_mark_services_known)) && Setting.auto_mark_known
+  end
+
   class Field < ActiveModelSerializers::Model
     attributes :name, :value, :verified_at, :account, :errors
 
diff --git a/app/models/form/admin_settings.rb b/app/models/form/admin_settings.rb
index f5006c3e3..00abb3906 100644
--- a/app/models/form/admin_settings.rb
+++ b/app/models/form/admin_settings.rb
@@ -37,6 +37,7 @@ class Form::AdminSettings
     auto_reject_unknown
     auto_mark_known
     auto_mark_instance_actors_known
+    auto_mark_services_known
     always_mark_instance_actors_known
     werewolf_status
     spam_check_enabled
@@ -62,6 +63,7 @@ class Form::AdminSettings
     auto_reject_unknown
     auto_mark_known
     auto_mark_instance_actors_known
+    auto_mark_services_known
     always_mark_instance_actors_known
     werewolf_status
     spam_check_enabled
diff --git a/app/services/favourite_service.rb b/app/services/favourite_service.rb
index aeac9728b..29838ed5f 100644
--- a/app/services/favourite_service.rb
+++ b/app/services/favourite_service.rb
@@ -15,7 +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?
+    account.mark_known! if account.can_be_marked_known? && Setting.mark_known_from_favourites
     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 1d9f1c726..68dcbda23 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 || !Setting.mark_known_from_follows || target_account.known?
+    target_account.mark_known! if target_account.can_be_marked_known? && Setting.mark_known_from_follows
 
     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 a36a1b074..7c36a5941 100644
--- a/app/services/post_status_service.rb
+++ b/app/services/post_status_service.rb
@@ -101,7 +101,7 @@ class PostStatusService < BaseService
   end
 
   def mark_recipient_known
-    @in_reply_to.account.mark_known! unless !Setting.auto_mark_known || !Setting.mark_known_from_mentions || @in_reply_to.account.known?
+    @in_reply_to.account.mark_known! if @in_reply_to.account.can_be_marked_known? && Setting.mark_known_from_mentions
   end
 
   def set_footer_from_i_am
diff --git a/app/services/reblog_service.rb b/app/services/reblog_service.rb
index 4b7002fca..1488a6361 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 || !Setting.mark_known_from_boosts || reblogged_status.account.known?
+      reblogged_status.account.mark_known! if reblogged_status.account.can_be_marked_known? && Setting.mark_known_from_boosts
       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 032188db3..bd1250ebd 100644
--- a/app/views/admin/settings/edit.html.haml
+++ b/app/views/admin/settings/edit.html.haml
@@ -46,6 +46,7 @@
     .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_services_known, as: :boolean, wrapper: :with_label, label: t('admin.settings.auto_mark_services_known.title'), hint: t('admin.settings.auto_mark_services_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