We'll handle this at the event level
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user