Class: Decidim::NotificationMailer
- Inherits:
-
ApplicationMailer
- Object
- ActionMailer::Base
- ApplicationMailer
- Decidim::NotificationMailer
- Defined in:
- app/mailers/decidim/notification_mailer.rb
Overview
A custom mailer for sending notifications to users when a events are received.
Instance Method Summary collapse
-
#event_received(event, event_class_name, resource, user, user_role, extra) ⇒ Object
rubocop:disable Metrics/ParameterLists.
Methods included from OrganizationHelper
#current_organization_name, #organization_colors, #organization_description_label, #organization_name
Methods included from TranslatableAttributes
Methods included from SanitizeHelper
#decidim_escape_translated, #decidim_html_escape, #decidim_sanitize, #decidim_sanitize_admin, #decidim_sanitize_editor, #decidim_sanitize_editor_admin, #decidim_sanitize_newsletter, #decidim_sanitize_translated, #decidim_url_escape, included
Instance Method Details
#event_received(event, event_class_name, resource, user, user_role, extra) ⇒ Object
rubocop:disable Metrics/ParameterLists
9 10 11 12 13 14 15 16 17 18 |
# File 'app/mailers/decidim/notification_mailer.rb', line 9 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:, event_name: event, user:, extra:, user_role:) subject = @event_instance.email_subject mail(to: user.email, subject:) end end |