Sha256: 024454276405ab601f188180e7887ca92c0ea83c90d2b32a26df8ca1fe073f27
Contents?: true
Size: 1.3 KB
Versions: 4
Compression:
Stored size: 1.3 KB
Contents
# frozen_string_literal: true module Decidim class NewsletterMailer < ApplicationMailer helper Decidim::SanitizeHelper helper Decidim::TranslationsHelper include Decidim::NewslettersHelper layout "decidim/newsletter_base" helper_method :cell def newsletter(user, newsletter) return if user.email.blank? @organization = user.organization @newsletter = newsletter @user = user @custom_url_for_mail_root = custom_url_for_mail_root(@organization, @newsletter.id) if Decidim.config.track_newsletter_links @encrypted_token = Decidim::NewsletterEncryptor.sent_at_encrypted(@user.id, @newsletter.sent_at) with_user(user) do uninterpolated_subject = @newsletter.subject[I18n.locale.to_s].presence || @newsletter.subject[@organization.default_locale] @subject = parse_interpolations(uninterpolated_subject, user, @newsletter.id) mail(to: "#{user.name} <#{user.email}>", subject: @subject) end end private def cell @cell ||= ::Decidim::ViewModel.cell( @newsletter.template.cell, @newsletter.template, organization: @organization, newsletter: @newsletter, recipient_user: @user, context: { controller: self } ) end end end
Version data entries
4 entries across 4 versions & 1 rubygems