about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--app/lib/activitypub/activity.rb1
-rw-r--r--app/services/activitypub/fetch_remote_account_service.rb1
-rw-r--r--app/services/activitypub/fetch_remote_status_service.rb1
-rw-r--r--app/services/activitypub/fetch_replies_service.rb1
-rw-r--r--app/services/activitypub/process_account_service.rb19
-rw-r--r--app/services/fetch_link_card_service.rb1
-rw-r--r--app/services/fetch_oembed_service.rb2
7 files changed, 1 insertions, 25 deletions
diff --git a/app/lib/activitypub/activity.rb b/app/lib/activitypub/activity.rb
index e4de18fce..12e925965 100644
--- a/app/lib/activitypub/activity.rb
+++ b/app/lib/activitypub/activity.rb
@@ -2,7 +2,6 @@
 
 class ActivityPub::Activity
   include JsonLdHelper
-  include AutorejectHelper
   include Redisable
 
   SUPPORTED_TYPES = %w(Note Question).freeze
diff --git a/app/services/activitypub/fetch_remote_account_service.rb b/app/services/activitypub/fetch_remote_account_service.rb
index 36a327731..85f4fb205 100644
--- a/app/services/activitypub/fetch_remote_account_service.rb
+++ b/app/services/activitypub/fetch_remote_account_service.rb
@@ -2,7 +2,6 @@
 
 class ActivityPub::FetchRemoteAccountService < BaseService
   include JsonLdHelper
-  include AutorejectHelper
   include DomainControlHelper
 
   SUPPORTED_TYPES = %w(Application Group Organization Person Service).freeze
diff --git a/app/services/activitypub/fetch_remote_status_service.rb b/app/services/activitypub/fetch_remote_status_service.rb
index 0779f13cc..f2e7c5757 100644
--- a/app/services/activitypub/fetch_remote_status_service.rb
+++ b/app/services/activitypub/fetch_remote_status_service.rb
@@ -2,7 +2,6 @@
 
 class ActivityPub::FetchRemoteStatusService < BaseService
   include JsonLdHelper
-  include AutorejectHelper
 
   # Should be called when uri has already been checked for locality
   def call(uri, id: true, prefetched_body: nil, on_behalf_of: nil, announced_by: nil, requested: false)
diff --git a/app/services/activitypub/fetch_replies_service.rb b/app/services/activitypub/fetch_replies_service.rb
index 6aae16dc1..6b5e05e7f 100644
--- a/app/services/activitypub/fetch_replies_service.rb
+++ b/app/services/activitypub/fetch_replies_service.rb
@@ -2,7 +2,6 @@
 
 class ActivityPub::FetchRepliesService < BaseService
   include JsonLdHelper
-  include AutorejectHelper
 
   def call(parent_status, collection_or_uri, allow_synchronous_requests = true)
     @account = parent_status.account
diff --git a/app/services/activitypub/process_account_service.rb b/app/services/activitypub/process_account_service.rb
index 96a2c4b0b..9f529ed52 100644
--- a/app/services/activitypub/process_account_service.rb
+++ b/app/services/activitypub/process_account_service.rb
@@ -24,7 +24,6 @@ class ActivityPub::ProcessAccountService < BaseService
 
         is_new_account = @account.nil?
         if is_new_account
-          copy_policy_of_parent_domain
           set_reject_unknown_policy if Setting.auto_reject_unknown && new_domain?
           create_account
         end
@@ -105,29 +104,13 @@ class ActivityPub::ProcessAccountService < BaseService
     @account.moved_to_account  = @json['movedTo'].present? ? moved_account : nil
   end
 
-  def copy_policy_of_parent_domain
-    domain_parts = @domain.split('.')
-    domains = (1..domain_parts.count-1).map { |i| domain_parts[i..-1].join('.') }
-    return if domains.empty?
-
-    existing_policy = DomainBlock.find_by(domain: domains)
-    return if existing_policy.nil?
-
-    policy_attributes = existing_policy.template
-    policy_attributes['domain'] = @domain
-    policy = DomainBlock.create!(policy_attributes)
-    user_friendly_action_log(existing_policy, :create, policy)
-
-    @new_domain = false
-  end
-
   def set_reject_unknown_policy
     DomainBlock.create!(domain: @domain, severity: :noop, reject_unknown: true)
     user_friendly_action_log(nil, :mark_unknown, @domain)
   end
 
   def new_domain?
-    @new_domain ||= !(Account.where(domain: @domain).exists? || DomainBlock.where(domain: @domain).exists?)
+    @new_domain ||= !(Account.where(domain: @domain).exists? || DomainBlock.rule_for(@domain)) || DomainAllow.rule_for(@domain)
   end
 
   def after_key_change!
diff --git a/app/services/fetch_link_card_service.rb b/app/services/fetch_link_card_service.rb
index 8587ef2a9..5323104ae 100644
--- a/app/services/fetch_link_card_service.rb
+++ b/app/services/fetch_link_card_service.rb
@@ -2,7 +2,6 @@
 
 class FetchLinkCardService < BaseService
   include UrlHelper
-  include AutorejectHelper
 
   URL_PATTERN = %r{
     (                                                                                                 #   $1 URL
diff --git a/app/services/fetch_oembed_service.rb b/app/services/fetch_oembed_service.rb
index 1cb0e28a7..74c1eb1f9 100644
--- a/app/services/fetch_oembed_service.rb
+++ b/app/services/fetch_oembed_service.rb
@@ -1,8 +1,6 @@
 # frozen_string_literal: true
 
 class FetchOEmbedService
-  include AutorejectHelper
-
   attr_reader :url, :options, :format, :endpoint_url
 
   def call(url, options = {})