From 3e374f4661b01c9433d8c69d8dabd9aae7d5fb28 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Thu, 13 Mar 2025 12:14:17 -0400 Subject: [PATCH] fix: Send assignment notifications only to the assignee(s) ref: https://37s.fizzy.37signals.com/buckets/693169850/bubbles/999008619 --- app/models/notifier/assigned.rb | 4 ++++ test/models/notifier_test.rb | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/app/models/notifier/assigned.rb b/app/models/notifier/assigned.rb index 1fa1818f3..283011b2a 100644 --- a/app/models/notifier/assigned.rb +++ b/app/models/notifier/assigned.rb @@ -1,2 +1,6 @@ class Notifier::Assigned < Notifier + private + def recipients + event.assignees + end end diff --git a/test/models/notifier_test.rb b/test/models/notifier_test.rb index aeddd9459..9e41ab3f4 100644 --- a/test/models/notifier_test.rb +++ b/test/models/notifier_test.rb @@ -33,4 +33,10 @@ class NotifierTest < ActiveSupport::TestCase assert_equal bubbles(:logo), Notification.last.resource end + + test "for assignment events only create a notification for the assignee" do + notifications = Notifier.for(events(:logo_assignment_jz)).generate + + assert_equal [ users(:jz) ], notifications.map(&:user) + end end