Sha256: 8cc1de165389065d51bdfdef1b24e256ba40d3cc4d2f368b8de807bc722c99e1

Contents?: true

Size: 754 Bytes

Versions: 15

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
    helper Decidim::SanitizeHelper

    def event_received(event, event_class_name, resource, user, user_role, extra) # rubocop:disable Metrics/ParameterLists
      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

15 entries across 15 versions & 1 rubygems

Version Path
decidim-core-0.27.9 app/mailers/decidim/notification_mailer.rb
decidim-core-0.27.8 app/mailers/decidim/notification_mailer.rb
decidim-core-0.27.7 app/mailers/decidim/notification_mailer.rb
decidim-core-0.27.6 app/mailers/decidim/notification_mailer.rb
decidim-core-0.26.10 app/mailers/decidim/notification_mailer.rb
decidim-core-0.26.9 app/mailers/decidim/notification_mailer.rb
decidim-core-0.27.5 app/mailers/decidim/notification_mailer.rb
decidim-core-0.26.8 app/mailers/decidim/notification_mailer.rb
decidim-core-0.27.4 app/mailers/decidim/notification_mailer.rb
decidim-core-0.27.3 app/mailers/decidim/notification_mailer.rb
decidim-core-0.26.7 app/mailers/decidim/notification_mailer.rb
decidim-core-0.26.5 app/mailers/decidim/notification_mailer.rb
decidim-core-0.27.2 app/mailers/decidim/notification_mailer.rb
decidim-core-0.27.1 app/mailers/decidim/notification_mailer.rb
decidim-core-0.26.4 app/mailers/decidim/notification_mailer.rb