about summary refs log tree commit diff
path: root/app/services/unsuspend_account_service.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2021-04-17 14:55:46 +0200
committerGitHub <noreply@github.com>2021-04-17 14:55:46 +0200
commit6d6000f61f7f611358a45efb3c557eb1e0a7e005 (patch)
treef6b31cd2e1fc3f0c8bb506a8221d2d2b4363ccfd /app/services/unsuspend_account_service.rb
parent480d7c9478a9be3ac668b21402a269db41b10b18 (diff)
Fix remote reporters not receiving suspend/unsuspend activities (#16050)
Diffstat (limited to 'app/services/unsuspend_account_service.rb')
-rw-r--r--app/services/unsuspend_account_service.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/app/services/unsuspend_account_service.rb b/app/services/unsuspend_account_service.rb
index ce9ee48ed..949c670aa 100644
--- a/app/services/unsuspend_account_service.rb
+++ b/app/services/unsuspend_account_service.rb
@@ -12,6 +12,7 @@ class UnsuspendAccountService < BaseService
     merge_into_home_timelines!
     merge_into_list_timelines!
     publish_media_attachments!
+    distribute_update_actor!
   end
 
   private
@@ -36,6 +37,16 @@ class UnsuspendAccountService < BaseService
     # @account would now be nil.
   end
 
+  def distribute_update_actor!
+    return unless @account.local?
+
+    account_reach_finder = AccountReachFinder.new(@account)
+
+    ActivityPub::DeliveryWorker.push_bulk(account_reach_finder.inboxes) do |inbox_url|
+      [signed_activity_json, @account.id, inbox_url]
+    end
+  end
+
   def merge_into_home_timelines!
     @account.followers_for_local_distribution.find_each do |follower|
       FeedManager.instance.merge_into_home(@account, follower)
@@ -81,4 +92,8 @@ class UnsuspendAccountService < BaseService
       end
     end
   end
+
+  def signed_activity_json
+    @signed_activity_json ||= Oj.dump(serialize_payload(@account, ActivityPub::UpdateSerializer, signer: @account))
+  end
 end