docbrown/app/workers/notifications/welcome_notification_worker.rb
Vaidehi Joshi 3bc0f49861
Only send notifications that belong to an active broadcast (#6319) [deploy]
* Use active in place of sent on internal broadcast routes

* Add and use active scope on broadcasts

* Update seeds + specs to use active broadcasts

* Add note about active broadcasts to /internal/broadcasts page
2020-02-27 08:02:45 -08:00

12 lines
367 B
Ruby

module Notifications
class WelcomeNotificationWorker
include Sidekiq::Worker
sidekiq_options queue: :low_priority, retry: 10
def perform(receiver_id, broadcast_id)
return unless (welcome_broadcast = Broadcast.active.find_by(id: broadcast_id))
Notifications::WelcomeNotification::Send.call(receiver_id, welcome_broadcast)
end
end
end