Class: FiatNotifications::Notification::RelayJob

Inherits:
ApplicationJob
  • Object
show all
Defined in:
app/jobs/fiat_notifications/notification/relay_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(notification) ⇒ Object



4
5
6
7
8
9
10
# File 'app/jobs/fiat_notifications/notification/relay_job.rb', line 4

def perform(notification)
  updated_count = ApplicationController.render partial: "system/notifications/users/#{notification.action}", locals: {notification: notification}, formats: [:html]
  ActionCable.server.broadcast "notifications:#{notification.recipient_id}", updated_count: updated_count

  list_item = ApplicationController.render partial: "system/notifications/users/list-item", locals: {notification: notification}, formats: [:html]
  ActionCable.server.broadcast "notifications:#{notification.recipient_id}", list_item: list_item
end