Class: StreamNotificationsJob
- Inherits:
-
Hyrax::ApplicationJob
- Object
- ActiveJob::Base
- Hyrax::ApplicationJob
- StreamNotificationsJob
- Defined in:
- app/jobs/stream_notifications_job.rb
Instance Method Summary collapse
Instance Method Details
#perform(users) ⇒ Object
2 3 4 5 6 7 8 9 10 11 |
# File 'app/jobs/stream_notifications_job.rb', line 2 def perform(users) # Do not use the ActionCable machinery if the feature is disabled return unless Hyrax.config.realtime_notifications? Array.wrap(users).each do |user| mailbox = UserMailbox.new(user) Hyrax::NotificationsChannel.broadcast_to(user, notifications_count: mailbox.unread_count, notifications_label: mailbox.label) end end |