Sha256: 285de6aa71fe56ed4b4ea66992640ce25b90c8deff40d73971ffbb1cc099ece0
Contents?: true
Size: 1.39 KB
Versions: 6
Compression:
Stored size: 1.39 KB
Contents
# frozen_string_literal: true module Decidim class NewsletterMailer < ApplicationMailer include Decidim::NewslettersHelper layout "decidim/newsletter_base" helper_method :cell def newsletter(user, newsletter, preview = nil) return if user.email.blank? @organization = user.organization @newsletter = newsletter @user = user @preview = preview @custom_url_for_mail_root = if @preview "#" elsif Decidim.config.track_newsletter_links custom_url_for_mail_root(@organization, @newsletter.id) end @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, custom_url_for_mail_root: @custom_url_for_mail_root, context: { controller: self } ) end end end
Version data entries
6 entries across 6 versions & 1 rubygems