Class: Decidim::Admin::NewsletterDeliveryJob

Inherits:
ApplicationJob
  • Object
show all
Defined in:
app/jobs/decidim/admin/newsletter_delivery_job.rb

Overview

Custom ApplicationJob scoped to the admin panel.

Instance Method Summary collapse

Instance Method Details

#perform(user, newsletter) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'app/jobs/decidim/admin/newsletter_delivery_job.rb', line 10

def perform(user, newsletter)
  NewsletterMailer.newsletter(user, newsletter).deliver_now

  # rubocop:disable Rails/SkipsModelValidations
  newsletter.with_lock do
    newsletter.increment!(:total_deliveries)
  end
  # rubocop:enable Rails/SkipsModelValidations
end