From 78c918180580bbd06d2f6d5c9dc6d81ee3ed1e38 Mon Sep 17 00:00:00 2001 From: Phil Lee Date: Wed, 5 Apr 2023 15:05:34 +0100 Subject: [PATCH] remove bulk upload mailer template - this template is no longer used --- app/mailers/bulk_upload_mailer.rb | 23 -------------------- app/services/bulk_upload/processor.rb | 6 ------ spec/mailers/bulk_upload_mailer_spec.rb | 28 ------------------------- 3 files changed, 57 deletions(-) diff --git a/app/mailers/bulk_upload_mailer.rb b/app/mailers/bulk_upload_mailer.rb index 2d0b20a92..1a1d0848d 100644 --- a/app/mailers/bulk_upload_mailer.rb +++ b/app/mailers/bulk_upload_mailer.rb @@ -5,7 +5,6 @@ class BulkUploadMailer < NotifyMailer FAILED_CSV_ERRORS_TEMPLATE_ID = "e27abcd4-5295-48c2-b127-e9ee4b781b75".freeze FAILED_FILE_SETUP_ERROR_TEMPLATE_ID = "24c9f4c7-96ad-470a-ba31-eb51b7cbafd9".freeze FAILED_SERVICE_ERROR_TEMPLATE_ID = "c3f6288c-7a74-4e77-99ee-6c4a0f6e125a".freeze - WITH_ERRORS_TEMPLATE_ID = "eb539005-6234-404e-812d-167728cf4274".freeze HOW_FIX_UPLOAD_TEMPLATE_ID = "21a07b26-f625-4846-9f4d-39e30937aa24".freeze def send_how_fix_upload_mail(bulk_upload:) @@ -126,26 +125,4 @@ class BulkUploadMailer < NotifyMailer }, ) end - - def send_bulk_upload_with_errors_mail(bulk_upload:) - count = bulk_upload.logs.where.not(status: %w[completed]).count - - n_logs = pluralize(count, "log") - - title = "We found #{n_logs} with errors" - - error_description = "We created logs from your #{bulk_upload.year_combo} #{bulk_upload.log_type} data. There was a problem with #{count} of the logs. Click the below link to fix these logs." - - send_email( - bulk_upload.user.email, - WITH_ERRORS_TEMPLATE_ID, - { - title:, - filename: bulk_upload.filename, - upload_timestamp: bulk_upload.created_at.to_fs(:govuk_date_and_time), - error_description:, - summary_report_link: resume_bulk_upload_lettings_result_url(bulk_upload), - }, - ) - end end diff --git a/app/services/bulk_upload/processor.rb b/app/services/bulk_upload/processor.rb index 4fe449348..49d44261f 100644 --- a/app/services/bulk_upload/processor.rb +++ b/app/services/bulk_upload/processor.rb @@ -59,12 +59,6 @@ private .deliver_later end - def send_fix_errors_mail - BulkUploadMailer - .send_bulk_upload_with_errors_mail(bulk_upload:) - .deliver_later - end - def send_success_mail BulkUploadMailer .send_bulk_upload_complete_mail(user:, bulk_upload:) diff --git a/spec/mailers/bulk_upload_mailer_spec.rb b/spec/mailers/bulk_upload_mailer_spec.rb index cd2c4767d..7039b61a5 100644 --- a/spec/mailers/bulk_upload_mailer_spec.rb +++ b/spec/mailers/bulk_upload_mailer_spec.rb @@ -81,34 +81,6 @@ RSpec.describe BulkUploadMailer do end end - context "when bulk upload has log which is not completed" do - before do - create(:lettings_log, :in_progress, bulk_upload:) - end - - describe "#send_bulk_upload_with_errors_mail" do - let(:error_description) do - "We created logs from your 2022/23 lettings data. There was a problem with 1 of the logs. Click the below link to fix these logs." - end - - it "sends correctly formed email" do - expect(notify_client).to receive(:send_email).with( - email_address: bulk_upload.user.email, - template_id: described_class::WITH_ERRORS_TEMPLATE_ID, - personalisation: { - title: "We found 1 log with errors", - filename: bulk_upload.filename, - upload_timestamp: bulk_upload.created_at.to_fs(:govuk_date_and_time), - error_description:, - summary_report_link: "http://localhost:3000/lettings-logs/bulk-upload-results/#{bulk_upload.id}/resume", - }, - ) - - mailer.send_bulk_upload_with_errors_mail(bulk_upload:) - end - end - end - describe "#send_correct_and_upload_again_mail" do context "when 2 columns with errors" do before do