]> cat aescling's git repositories - mastodon.git/commitdiff
Fix processing of incoming Block activities (#15546)
authorThibG <thib@sitedethib.com>
Tue, 12 Jan 2021 08:25:01 +0000 (09:25 +0100)
committerGitHub <noreply@github.com>
Tue, 12 Jan 2021 08:25:01 +0000 (09:25 +0100)
Unlike locally-issued blocks, they weren't clearing follow
relationships in both directions, follow requests or notifications.

Co-authored-by: Claire <claire.github-309c@sitedethib.com>
app/lib/activitypub/activity/block.rb

index 90477bf3369dca5416f54bdf813fe3e40400bce3..92a0f813fb355671550e81ae2d9bb3bb66bfb285 100644 (file)
@@ -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
This page took 0.024267 seconds and 3 git commands to generate.