discourse/app/jobs/regular/download_backup_email.rb
Blake Erickson 80858bae2c FEATURE: further restrict downloading of backups
- send email to logged in admin when they press the "download" button
- show pop-up that email was sent
- create email template
- require a valid token to download backup
2017-03-01 08:28:34 -07:00

23 lines
571 B
Ruby

require_dependency 'email/sender'
module Jobs
class DownloadBackupEmail < Jobs::Base
sidekiq_options queue: 'critical'
def execute(args)
to_address = args[:to_address]
backup_file_path = args[:backup_file_path]
raise Discourse::InvalidParameters.new(:to_address) if to_address.blank?
raise Discourse::InvalidParameters.new(:backup_file_path) if backup_file_path.blank?
message = DownloadBackupMailer.send_email(to_address, backup_file_path)
Email::Sender.new(message, :download_backup_message).send
end
end
end