From af2aec1a82a13dc755d0dae893861d35c01fb0c6 Mon Sep 17 00:00:00 2001
From: Claire <claire.github-309c@sitedethib.com>
Date: Wed, 7 Aug 2024 13:12:36 +0200
Subject: [PATCH] Change notification requests to only count mentions (#31322)

---
 app/models/notification_request.rb       | 2 +-
 spec/models/notification_policy_spec.rb  | 2 +-
 spec/models/notification_request_spec.rb | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/app/models/notification_request.rb b/app/models/notification_request.rb
index 2f601ac36b..f0778b3af3 100644
--- a/app/models/notification_request.rb
+++ b/app/models/notification_request.rb
@@ -47,6 +47,6 @@ class NotificationRequest < ApplicationRecord
   private
 
   def prepare_notifications_count
-    self.notifications_count = Notification.where(account: account, from_account: from_account, filtered: true).limit(MAX_MEANINGFUL_COUNT).count
+    self.notifications_count = Notification.where(account: account, from_account: from_account, type: :mention, filtered: true).limit(MAX_MEANINGFUL_COUNT).count
   end
 end
diff --git a/spec/models/notification_policy_spec.rb b/spec/models/notification_policy_spec.rb
index cfd8e85eda..02a582bb08 100644
--- a/spec/models/notification_policy_spec.rb
+++ b/spec/models/notification_policy_spec.rb
@@ -9,7 +9,7 @@ RSpec.describe NotificationPolicy do
     let(:sender) { Fabricate(:account) }
 
     before do
-      Fabricate.times(2, :notification, account: subject.account, activity: Fabricate(:status, account: sender), filtered: true)
+      Fabricate.times(2, :notification, account: subject.account, activity: Fabricate(:status, account: sender), filtered: true, type: :mention)
       Fabricate(:notification_request, account: subject.account, from_account: sender)
       subject.summarize!
     end
diff --git a/spec/models/notification_request_spec.rb b/spec/models/notification_request_spec.rb
index 4adddc194f..9884132ca7 100644
--- a/spec/models/notification_request_spec.rb
+++ b/spec/models/notification_request_spec.rb
@@ -8,7 +8,7 @@ RSpec.describe NotificationRequest do
 
     context 'when there are remaining notifications' do
       before do
-        Fabricate(:notification, account: subject.account, activity: Fabricate(:status, account: subject.from_account), filtered: true)
+        Fabricate(:notification, account: subject.account, activity: Fabricate(:status, account: subject.from_account), filtered: true, type: :mention)
         subject.reconsider_existence!
       end