We'll handle this at the event level

This commit is contained in:
Kevin McConnell
2025-02-07 16:24:18 +00:00
parent 70f7f100a9
commit 39c0a95e1a
2 changed files with 2 additions and 16 deletions
+2 -8
View File
@@ -10,10 +10,8 @@ class Notifier
end
def generate
if should_notify?
recipients.map do |recipient|
Notification.create! user: recipient, event: event, bubble: bubble, resource: resource
end
recipients.map do |recipient|
Notification.create! user: recipient, event: event, bubble: bubble, resource: resource
end
end
@@ -22,10 +20,6 @@ class Notifier
@event = event
end
def should_notify?
bubble.published?
end
def recipients
bubble.bucket.users.without(creator)
end
-8
View File
@@ -18,12 +18,4 @@ class NotifierTest < ActiveSupport::TestCase
Notifier.for(events(:logo_published)).generate
end
end
test "generate does not create notifications if the bubble is not published" do
bubbles(:logo).drafted!
assert_no_difference -> { Notification.count } do
Notifier.for(events(:logo_published)).generate
end
end
end