Sha256: 5b2854f940f45f78c4aad1f86c9de77f465ec8eca08914dd78c3bbe145d702b0

Contents?: true

Size: 754 Bytes

Versions: 23

Compression:

Stored size: 754 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, user_role, extra) # rubocop:disable Metrics/ParameterLists
      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, user_role: user_role)
        subject = @event_instance.email_subject

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

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
decidim-core-0.23.6 app/mailers/decidim/notification_mailer.rb
decidim-core-0.23.5 app/mailers/decidim/notification_mailer.rb
decidim-core-0.24.0.rc2 app/mailers/decidim/notification_mailer.rb
decidim-core-0.23.4 app/mailers/decidim/notification_mailer.rb
decidim-core-0.24.0.rc1 app/mailers/decidim/notification_mailer.rb
decidim-core-0.23.3 app/mailers/decidim/notification_mailer.rb
decidim-core-0.23.2 app/mailers/decidim/notification_mailer.rb
decidim-core-0.23.1 app/mailers/decidim/notification_mailer.rb
decidim-core-0.23.1.rc1 app/mailers/decidim/notification_mailer.rb
decidim-core-0.23.0 app/mailers/decidim/notification_mailer.rb
decidim-core-0.22.0 app/mailers/decidim/notification_mailer.rb
decidim-core-0.21.0 app/mailers/decidim/notification_mailer.rb
decidim-core-0.20.1 app/mailers/decidim/notification_mailer.rb
decidim-core-0.20.0 app/mailers/decidim/notification_mailer.rb
decidim-core-0.19.1 app/mailers/decidim/notification_mailer.rb
decidim-core-0.18.1 app/mailers/decidim/notification_mailer.rb
decidim-core-0.19.0 app/mailers/decidim/notification_mailer.rb
decidim-core-0.17.2 app/mailers/decidim/notification_mailer.rb
decidim-core-0.18.0 app/mailers/decidim/notification_mailer.rb
decidim-core-0.17.1 app/mailers/decidim/notification_mailer.rb