Sha256: c510b71b47f347e06784038fc7454551248dd66fbb741ab0847e1bc5f4a81dfb

Contents?: true

Size: 1.48 KB

Versions: 35

Compression:

Stored size: 1.48 KB

Contents

# frozen_string_literal: true

module Decidim
  # This mailer sends a notification email containing the export as an
  # attachment.
  class ExportMailer < ApplicationMailer
    # Public: Sends a notification email with the result of an export in a
    # zipped file.
    #
    # user        - The user to be notified.
    # export_name - The name of the export.
    # export_data - The data containing the result of the export.
    #
    # Returns nothing.
    def export(user, export_name, export_data)
      @user = user
      @organization = user.organization

      filename = export_data.filename(export_name)
      filename_without_extension = export_data.filename(export_name, extension: false)

      attachments["#{filename_without_extension}.zip"] = FileZipper.new(filename, export_data.read).zip

      with_user(user) do
        mail(to: "#{user.name} <#{user.email}>", subject: I18n.t("decidim.export_mailer.subject", name: filename))
      end
    end

    # Public: Sends a notification email with a link to retrieve
    # the result of a data_portability export in a zipped file.
    #
    # user - The user to be notified.
    #
    # Returns nothing.
    def data_portability_export(user, filename, password)
      @user = user
      @organization = user.organization
      @filename = filename
      @password = password

      with_user(user) do
        mail(to: "#{user.name} <#{user.email}>", subject: I18n.t("decidim.export_mailer.subject", name: user.name))
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
decidim-core-0.26.10 app/mailers/decidim/export_mailer.rb
decidim-core-0.26.9 app/mailers/decidim/export_mailer.rb
decidim-core-0.26.8 app/mailers/decidim/export_mailer.rb
decidim-core-0.26.7 app/mailers/decidim/export_mailer.rb
decidim-core-0.26.5 app/mailers/decidim/export_mailer.rb
decidim-core-0.26.4 app/mailers/decidim/export_mailer.rb
decidim-core-0.26.3 app/mailers/decidim/export_mailer.rb
decidim-core-0.26.2 app/mailers/decidim/export_mailer.rb
decidim-core-0.26.1 app/mailers/decidim/export_mailer.rb
decidim-core-0.26.0 app/mailers/decidim/export_mailer.rb
decidim-core-0.26.0.rc2 app/mailers/decidim/export_mailer.rb
decidim-core-0.26.0.rc1 app/mailers/decidim/export_mailer.rb
decidim-core-0.25.2 app/mailers/decidim/export_mailer.rb
decidim-core-0.25.1 app/mailers/decidim/export_mailer.rb
decidim-core-0.25.0 app/mailers/decidim/export_mailer.rb
decidim-core-0.25.0.rc4 app/mailers/decidim/export_mailer.rb
decidim-core-0.25.0.rc3 app/mailers/decidim/export_mailer.rb
decidim-core-0.25.0.rc2 app/mailers/decidim/export_mailer.rb
decidim-core-0.25.0.rc1 app/mailers/decidim/export_mailer.rb
decidim-core-0.24.3 app/mailers/decidim/export_mailer.rb