Sha256: 8b76efedae4c89dfb8cbe54bd2c077d28a689cdff05ba27dff88cbf0dc848d28

Contents?: true

Size: 680 Bytes

Versions: 3

Compression:

Stored size: 680 Bytes

Contents

# frozen_string_literal: true

module Decidim
  # A custom mailer for sending notifications to users when
  # a events are received.
  class NotificationMailer < Decidim::ApplicationMailer
    helper Decidim::ResourceHelper

    def event_received(event, event_class_name, resource, user, extra)
      return if user.email.blank?

      with_user(user) do
        @organization = user.organization
        event_class = event_class_name.constantize
        @event_instance = event_class.new(resource: resource, event_name: event, user: user, extra: extra)
        subject = @event_instance.email_subject

        mail(to: user.email, subject: subject)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
decidim-core-0.15.2 app/mailers/decidim/notification_mailer.rb
decidim-core-0.15.1 app/mailers/decidim/notification_mailer.rb
decidim-core-0.15.0 app/mailers/decidim/notification_mailer.rb