Class: Decidim::NotificationsDigestMailer
- Inherits:
-
ApplicationMailer
- Object
- ActionMailer::Base
- ApplicationMailer
- Decidim::NotificationsDigestMailer
- Defined in:
- app/mailers/decidim/notifications_digest_mailer.rb
Overview
A custom mailer for sending notifications to users when a events are received.
Constant Summary collapse
- SIZE_LIMIT =
10
Instance Method Summary collapse
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
#digest_mail(user, notification_ids) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/mailers/decidim/notifications_digest_mailer.rb', line 10 def digest_mail(user, notification_ids) with_user(user) do notifications = Decidim::Notification.where(id: notification_ids) @user = user @organization = user.organization @notifications_digest = Decidim::NotificationsDigestPresenter.new(user) @display_see_more_message = notifications.size > SIZE_LIMIT @notifications = notifications[0...SIZE_LIMIT].map { |notification| Decidim::NotificationToMailerPresenter.new(notification) } mail(to: user.email, subject: @notifications_digest.subject) end end |