From 5d890ebc574a8ec778619c3ddfe2530b3e0a7297 Mon Sep 17 00:00:00 2001
From: Claire <claire.github-309c@sitedethib.com>
Date: Tue, 6 Aug 2024 12:07:16 +0200
Subject: [PATCH] Delete pending notification requests on block and
 notification mutes (#31310)

---
 app/services/after_block_service.rb | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/app/services/after_block_service.rb b/app/services/after_block_service.rb
index 899e84be4..f0f836a54 100644
--- a/app/services/after_block_service.rb
+++ b/app/services/after_block_service.rb
@@ -7,6 +7,7 @@ class AfterBlockService < BaseService
 
     clear_home_feed!
     clear_list_feeds!
+    clear_notification_requests!
     clear_notifications!
     clear_conversations!
   end
@@ -28,4 +29,8 @@ class AfterBlockService < BaseService
   def clear_notifications!
     Notification.where(account: @account).where(from_account: @target_account).in_batches.delete_all
   end
+
+  def clear_notification_requests!
+    NotificationRequest.where(account: @account, from_account: @target_account).destroy_all
+  end
 end