about summary refs log tree commit diff
path: root/app/services
diff options
context:
space:
mode:
Diffstat (limited to 'app/services')
-rw-r--r--app/services/backup_service.rb2
-rw-r--r--app/services/process_mentions_service.rb2
-rw-r--r--app/services/reblog_service.rb2
-rw-r--r--app/services/remove_status_service.rb15
4 files changed, 12 insertions, 9 deletions
diff --git a/app/services/backup_service.rb b/app/services/backup_service.rb
index 749c84736..b83c08a98 100644
--- a/app/services/backup_service.rb
+++ b/app/services/backup_service.rb
@@ -22,7 +22,7 @@ class BackupService < BaseService
 
     account.statuses.with_includes.reorder(nil).find_in_batches do |statuses|
       statuses.each do |status|
-        item = serialize_payload(ActivityPub::ActivityPresenter.from_status(status), ActivityPub::ActivitySerializer, signer: @account, allow_local_only: true)
+        item = serialize_payload(ActivityPub::ActivityPresenter.from_status(status, nil), ActivityPub::ActivitySerializer, signer: @account, allow_local_only: true)
         item.delete(:'@context')
 
         unless item[:type] == 'Announce' || item[:object][:attachment].blank?
diff --git a/app/services/process_mentions_service.rb b/app/services/process_mentions_service.rb
index 56cfbdccd..51c368264 100644
--- a/app/services/process_mentions_service.rb
+++ b/app/services/process_mentions_service.rb
@@ -37,7 +37,7 @@ class ProcessMentionsService < BaseService
   end
 
   def activitypub_json(domain)
-    @activitypub_json[domain] ||= Oj.dump(serialize_payload(ActivityPub::ActivityPresenter.from_status(@status, embed: false), ActivityPub::ActivitySerializer, signer: @status.account, target_domain: domain))
+    @activitypub_json[domain] ||= Oj.dump(serialize_payload(ActivityPub::ActivityPresenter.from_status(@status, domain, embed: false), ActivityPub::ActivitySerializer, signer: @status.account, domain: domain))
   end
 
   def check_for_spam(status)
diff --git a/app/services/reblog_service.rb b/app/services/reblog_service.rb
index 3188bbb69..93b0c160b 100644
--- a/app/services/reblog_service.rb
+++ b/app/services/reblog_service.rb
@@ -61,7 +61,7 @@ class ReblogService < BaseService
   end
 
   def build_json(reblog)
-    Oj.dump(serialize_payload(ActivityPub::ActivityPresenter.from_status(reblog, embed: false), ActivityPub::ActivitySerializer, signer: reblog.account, target_domain: reblog.account.domain))
+    Oj.dump(serialize_payload(ActivityPub::ActivityPresenter.from_status(reblog, reblog.account.domain, embed: false), ActivityPub::ActivitySerializer, signer: reblog.account, domain: reblog.account.domain))
   end
 
   def curate!(status)
diff --git a/app/services/remove_status_service.rb b/app/services/remove_status_service.rb
index 8025f235b..beb415f94 100644
--- a/app/services/remove_status_service.rb
+++ b/app/services/remove_status_service.rb
@@ -19,6 +19,8 @@ class RemoveStatusService < BaseService
     @reblogs  = status.reblogs.includes(:account).to_a
     @options  = options
 
+    @signed_activity_json = {}
+
     RedisLock.acquire(lock_options) do |lock|
       if lock.acquired?
         remove_from_self if status.account.local? && !@options[:unpublish]
@@ -95,18 +97,18 @@ class RemoveStatusService < BaseService
 
     # ActivityPub
     ActivityPub::DeliveryWorker.push_bulk(target_accounts.select(&:activitypub?).uniq(&:preferred_inbox_url)) do |target_account|
-      [signed_activity_json, @account.id, target_account.preferred_inbox_url]
+      [signed_activity_json(inbox_url), @account.id, target_account.preferred_inbox_url]
     end
   end
 
   def remove_from_remote_followers
     # ActivityPub
     ActivityPub::DeliveryWorker.push_bulk(@account.followers.inboxes) do |inbox_url|
-      [signed_activity_json, @account.id, inbox_url]
+      [signed_activity_json(inbox_url), @account.id, inbox_url]
     end
 
     ActivityPub::DeliveryWorker.push_bulk(@account.following.inboxes) do |inbox_url|
-      [signed_activity_json, @account.id, inbox_url]
+      [signed_activity_json(inbox_url), @account.id, inbox_url]
     end
 
     relay! if relayable?
@@ -118,12 +120,13 @@ class RemoveStatusService < BaseService
 
   def relay!
     ActivityPub::DeliveryWorker.push_bulk(Relay.enabled.pluck(:inbox_url)) do |inbox_url|
-      [signed_activity_json(Addressable::URI.parse(inbox_url).host), @account.id, inbox_url]
+      [signed_activity_json(inbox_url), @account.id, inbox_url]
     end
   end
 
-  def signed_activity_json
-    @signed_activity_json ||= Oj.dump(serialize_payload(@status, @status.reblog? && @status.spoiler_text.blank? ? ActivityPub::UndoAnnounceSerializer : ActivityPub::DeleteSerializer, signer: @account))
+  def signed_activity_json(inbox_url)
+    domain = Addressable::URI.parse(inbox_url).normalized_host
+    @signed_activity_json[domain] ||= Oj.dump(serialize_payload(@status, @status.reblog? && @status.spoiler_text.blank? ? ActivityPub::UndoAnnounceSerializer : ActivityPub::DeleteSerializer, signer: @account, domain: domain))
   end
 
   def remove_reblogs