Class: Decidim::EventPublisherJob

Inherits:
ApplicationJob show all
Defined in:
decidim-core/app/jobs/decidim/event_publisher_job.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#resourceObject (readonly)

Returns the value of attribute resource.



7
8
9
# File 'decidim-core/app/jobs/decidim/event_publisher_job.rb', line 7

def resource
  @resource
end

Instance Method Details

#perform(event_name, data) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'decidim-core/app/jobs/decidim/event_publisher_job.rb', line 9

def perform(event_name, data)
  @resource = data[:resource]

  return unless data[:force_send] || notifiable?

  EmailNotificationGeneratorJob.perform_later(
    event_name,
    data[:event_class],
    data[:resource],
    data[:followers],
    data[:affected_users],
    data[:extra]
  )

  NotificationGeneratorJob.perform_later(
    event_name,
    data[:event_class],
    data[:resource],
    data[:followers],
    data[:affected_users],
    data[:extra]
  )
end