Commit 5ba2ccff authored by James Edwards-Jones's avatar James Edwards-Jones

Extracted CSV export mailer from issues mailer

parent 40b004b9
module Emails
module CsvExport
def issues_csv_email(user, project, csv_data, export_status)
@project = project
@issues_count = export_status.fetch(:rows_expected)
@written_count = export_status.fetch(:rows_written)
@truncated = export_status.fetch(:truncated)
filename = "#{project.full_path.parameterize}_issues_#{Date.today.iso8601}.csv"
attachments[filename] = { content: csv_data, mime_type: 'text/csv' }
mail(to: user.notification_email, subject: subject("Exported issues")) do |format|
format.html { render layout: 'mailer' }
format.text { render layout: 'mailer' }
end
end
end
end
...@@ -49,20 +49,6 @@ module Emails ...@@ -49,20 +49,6 @@ module Emails
mail_answer_thread(issue, issue_thread_options(updated_by_user.id, recipient.id)) mail_answer_thread(issue, issue_thread_options(updated_by_user.id, recipient.id))
end end
def issues_csv_email(user, project, csv_data, export_status)
@project = project
@issues_count = export_status.fetch(:rows_expected)
@written_count = export_status.fetch(:rows_written)
@truncated = export_status.fetch(:truncated)
filename = "#{project.full_path.parameterize}_issues_#{Date.today.iso8601}.csv"
attachments[filename] = { content: csv_data, mime_type: 'text/csv' }
mail(to: user.notification_email, subject: subject("Exported issues"), skip_premailer: true) do |format|
format.html { render layout: 'mailer' }
format.text { render layout: 'mailer' }
end
end
private private
def setup_issue_mail(issue_id, recipient_id) def setup_issue_mail(issue_id, recipient_id)
......
...@@ -3,6 +3,7 @@ class Notify < BaseMailer ...@@ -3,6 +3,7 @@ class Notify < BaseMailer
include Emails::AdminNotification include Emails::AdminNotification
include Emails::Issues include Emails::Issues
include Emails::CsvExport
include Emails::MergeRequests include Emails::MergeRequests
include Emails::Notes include Emails::Notes
include Emails::Projects include Emails::Projects
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment