From 7bed25f3eabecc84268a4b6c254cc3e0738926b6 Mon Sep 17 00:00:00 2001 From: ThibG Date: Tue, 12 Jan 2021 09:25:01 +0100 Subject: [PATCH] Fix processing of incoming Block activities (#15546) Unlike locally-issued blocks, they weren't clearing follow relationships in both directions, follow requests or notifications. Co-authored-by: Claire --- app/lib/activitypub/activity/block.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/lib/activitypub/activity/block.rb b/app/lib/activitypub/activity/block.rb index 90477bf336..92a0f813fb 100644 --- a/app/lib/activitypub/activity/block.rb +++ b/app/lib/activitypub/activity/block.rb @@ -11,8 +11,13 @@ class ActivityPub::Activity::Block < ActivityPub::Activity return end + UnfollowService.new.call(@account, target_account) if @account.following?(target_account) UnfollowService.new.call(target_account, @account) if target_account.following?(@account) + RejectFollowService.new.call(target_account, @account) if target_account.requested?(@account) - @account.block!(target_account, uri: @json['id']) unless delete_arrived_first?(@json['id']) + unless delete_arrived_first?(@json['id']) + BlockWorker.perform_async(@account.id, target_account.id) + @account.block!(target_account, uri: @json['id']) + end end end