about summary refs log tree commit diff
path: root/app/services
diff options
context:
space:
mode:
authorFire Demon <firedemon@creature.cafe>2020-08-22 18:58:36 -0500
committerFire Demon <firedemon@creature.cafe>2020-08-30 05:45:19 -0500
commit7ec22bd569c47adb7d82697228e5b785615cd1e2 (patch)
tree1f5ea50fd5bb969ad785736c66d60caa7b6ad62a /app/services
parent6c3a1729e38264d811c1ccbe25a91b7c9b04ba9d (diff)
[Privacy] Unlink blocked replies
Diffstat (limited to 'app/services')
-rw-r--r--app/services/after_block_service.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/services/after_block_service.rb b/app/services/after_block_service.rb
index 2a0e10a79..432ba65e6 100644
--- a/app/services/after_block_service.rb
+++ b/app/services/after_block_service.rb
@@ -8,6 +8,8 @@ class AfterBlockService < BaseService
     clear_home_feed!
     clear_notifications!
     clear_conversations!
+    unlink_replies!
+    unlink_mentions!
   end
 
   private
@@ -23,4 +25,16 @@ class AfterBlockService < BaseService
   def clear_notifications!
     Notification.where(account: @account).where(from_account: @target_account).in_batches.delete_all
   end
+
+  def unlink_replies!
+    @target_account.statuses.where(in_reply_to_account_id: @account.id)
+                   .or(@account.statuses.where(in_reply_to_account_id: @target_account.id))
+                   .in_batches.update_all(in_reply_to_account_id: nil)
+  end
+
+  def unlink_mentions!
+    @account.mentions.where(account_id: @target_account.id)
+            .or(@target_account.mentions.where(account_id: @account.id))
+            .in_batches.destroy_all
+  end
 end