You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cartodb/app/mailers/import_mailer.rb

42 lines
1.2 KiB

require 'json'
class ImportMailer < ActionMailer::Base
default from: Cartodb.get_config(:mailer, 'from')
layout 'mail'
def data_import_finished(user, imported_tables, total_tables, first_imported_table, first_table, errors, filenames)
@errors = errors
@imported_tables = imported_tables
@total_tables = total_tables
9 years ago
@subject = set_subject
@first_table = first_imported_table.nil? ? first_table : first_imported_table
@username = user.username
@files = filenames
@link = first_imported_table.nil? ? "#{user.public_url}#{CartoDB.path(self, 'tables_index')}" : "#{user.public_url}#{CartoDB.path(self, 'public_tables_show', { id: @first_table['name'] })}"
9 years ago
mail :to => user.email,
:subject => @subject
end
private
def set_subject
if @total_tables == 1
if @errors.nil?
subject = "Your dataset import just finished"
else
subject = "There was some error while importing your dataset"
end
else
if @imported_tables == 0
subject = "There was some error while importing your datasets"
else
subject = "Your datasets import just finished"
end
end
subject
end
end