Sha256: 9fc3e4145295e9c2d6f958c9efe1ed6da0493461fff5e6afa6d2204e7aaf34a0

Contents?: true

Size: 719 Bytes

Versions: 20

Compression:

Stored size: 719 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
      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

20 entries across 20 versions & 1 rubygems

Version Path
decidim-core-0.27.0 app/mailers/decidim/notification_mailer.rb
decidim-core-0.26.3 app/mailers/decidim/notification_mailer.rb
decidim-core-0.27.0.rc2 app/mailers/decidim/notification_mailer.rb
decidim-core-0.27.0.rc1 app/mailers/decidim/notification_mailer.rb
decidim-core-0.26.2 app/mailers/decidim/notification_mailer.rb
decidim-core-0.26.1 app/mailers/decidim/notification_mailer.rb
decidim-core-0.26.0 app/mailers/decidim/notification_mailer.rb
decidim-core-0.26.0.rc2 app/mailers/decidim/notification_mailer.rb
decidim-core-0.26.0.rc1 app/mailers/decidim/notification_mailer.rb
decidim-core-0.25.2 app/mailers/decidim/notification_mailer.rb
decidim-core-0.25.1 app/mailers/decidim/notification_mailer.rb
decidim-core-0.25.0 app/mailers/decidim/notification_mailer.rb
decidim-core-0.25.0.rc4 app/mailers/decidim/notification_mailer.rb
decidim-core-0.25.0.rc3 app/mailers/decidim/notification_mailer.rb
decidim-core-0.25.0.rc2 app/mailers/decidim/notification_mailer.rb
decidim-core-0.25.0.rc1 app/mailers/decidim/notification_mailer.rb
decidim-core-0.24.3 app/mailers/decidim/notification_mailer.rb
decidim-core-0.24.2 app/mailers/decidim/notification_mailer.rb
decidim-core-0.24.1 app/mailers/decidim/notification_mailer.rb
decidim-core-0.24.0 app/mailers/decidim/notification_mailer.rb