Fix where text/csv exports weren't always uploaded as attachment
This commit is contained in:
parent
292d31132f
commit
26704b1d94
4 changed files with 4 additions and 2 deletions
|
@ -53,7 +53,7 @@ module ExportPayments
|
||||||
file_date = Time.now.getutc().strftime('%m-%d-%Y--%H-%M-%S')
|
file_date = Time.now.getutc().strftime('%m-%d-%Y--%H-%M-%S')
|
||||||
filename = "tmp/csv-exports/payments-#{file_date}.csv"
|
filename = "tmp/csv-exports/payments-#{file_date}.csv"
|
||||||
|
|
||||||
url = CHUNKED_UPLOADER.upload(filename, QueryPayments.for_export_enumerable(npo_id, params, 30000).map{|i| i.to_csv}, :content_type => 'text/csv')
|
url = CHUNKED_UPLOADER.upload(filename, QueryPayments.for_export_enumerable(npo_id, params, 30000).map{|i| i.to_csv}, :content_type => 'text/csv', content_disposition: 'attachment')
|
||||||
export.url = url
|
export.url = url
|
||||||
export.status = :completed
|
export.status = :completed
|
||||||
export.ended = Time.now
|
export.ended = Time.now
|
||||||
|
|
|
@ -53,7 +53,7 @@ module ExportRecurringDonations
|
||||||
file_date = Time.now.getutc().strftime('%m-%d-%Y--%H-%M-%S')
|
file_date = Time.now.getutc().strftime('%m-%d-%Y--%H-%M-%S')
|
||||||
filename = "tmp/csv-exports/recurring_donations-#{file_date}.csv"
|
filename = "tmp/csv-exports/recurring_donations-#{file_date}.csv"
|
||||||
|
|
||||||
url = CHUNKED_UPLOADER.upload(filename, QueryRecurringDonations.for_export_enumerable(npo_id, params, 30000).map{|i| i.to_csv}, :content_type => 'text/csv')
|
url = CHUNKED_UPLOADER.upload(filename, QueryRecurringDonations.for_export_enumerable(npo_id, params, 30000).map{|i| i.to_csv}, :content_type => 'text/csv', content_disposition: 'attachment')
|
||||||
export.url = url
|
export.url = url
|
||||||
export.status = :completed
|
export.status = :completed
|
||||||
export.ended = Time.now
|
export.ended = Time.now
|
||||||
|
|
|
@ -192,6 +192,7 @@ describe ExportPayments do
|
||||||
expect(csv[0]).to eq MockHelpers.payment_export_headers
|
expect(csv[0]).to eq MockHelpers.payment_export_headers
|
||||||
|
|
||||||
expect(TestChunkedUploader.options[:content_type]).to eq 'text/csv'
|
expect(TestChunkedUploader.options[:content_type]).to eq 'text/csv'
|
||||||
|
expect(TestChunkedUploader.options[:content_disposition]).to eq 'attachment'
|
||||||
expect(user).to have_received_email(subject: "Your payment export is available!")
|
expect(user).to have_received_email(subject: "Your payment export is available!")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -194,6 +194,7 @@ describe ExportRecurringDonations do
|
||||||
expect(csv[0]).to eq MockHelpers.recurring_donation_export_headers
|
expect(csv[0]).to eq MockHelpers.recurring_donation_export_headers
|
||||||
|
|
||||||
expect(TestChunkedUploader.options[:content_type]).to eq 'text/csv'
|
expect(TestChunkedUploader.options[:content_type]).to eq 'text/csv'
|
||||||
|
expect(TestChunkedUploader.options[:content_disposition]).to eq 'attachment'
|
||||||
expect(@user).to have_received_email(subject: "Your recurring donations export is available!")
|
expect(@user).to have_received_email(subject: "Your recurring donations export is available!")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue