Sha256: 2c0133bc240c703ffe83ca9195ec3a1f9cb76837304726197563c7f04999a90e

Contents?: true

Size: 681 Bytes

Versions: 1

Compression:

Stored size: 681 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module ReportingProposals
    module Admin
      module AssignProposalsToValuatorOverride
        extend ActiveSupport::Concern

        included do
          def call
            return broadcast(:invalid) unless form.valid?

            assign_proposals
            send_email

            broadcast(:ok)
          rescue ActiveRecord::RecordInvalid
            broadcast(:invalid)
          end

          private

          def send_email
            ProposalsValuatorMailer.notify_proposals_valuator(form.valuator_role.user, form.current_user, form.proposals).deliver_later
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
decidim-reporting_proposals-0.6.0 app/commands/concerns/decidim/reporting_proposals/admin/assign_proposals_to_valuator_override.rb