Sha256: 70382962f9895d66304d6c52253cb6fed34e334224a82ce1802e4cc88ca2542b
Contents?: true
Size: 634 Bytes
Versions: 10
Compression:
Stored size: 634 Bytes
Contents
# frozen_string_literal: true module Decidim module Admin # Delivers the newsletter to its recipients. class DeliverNewsletter < Rectify::Command # Initializes the command. # # newsletter - The newsletter to deliver. def initialize(newsletter) @newsletter = newsletter end def call @newsletter.with_lock do return broadcast(:invalid) if @newsletter.sent? send_newsletter! end broadcast(:ok, @newsletter) end private def send_newsletter! NewsletterJob.perform_later(@newsletter) end end end end
Version data entries
10 entries across 10 versions & 2 rubygems