Skip to content

Commit

Permalink
Merge pull request #7135 from ministryofjustice/ap-5276-remove-feedba…
Browse files Browse the repository at this point in the history
…ck-emails

AP-5276: Stop sending feedback emails
  • Loading branch information
agoldstone93 authored Sep 10, 2024
2 parents dd543f8 + 6a6d4f9 commit a38af6c
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 170 deletions.
5 changes: 0 additions & 5 deletions app/controllers/feedback_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ def create
@display_close_tab_msg = params["signed_out"].present?

if @feedback.save
ScheduledMailing.send_now!(mailer_klass: FeedbackMailer,
mailer_method: :notify,
legal_aid_application_id: application_id,
addressee: Rails.configuration.x.support_email_address,
arguments: [@feedback.id, application_id])
render :show
else
render :new
Expand Down
2 changes: 1 addition & 1 deletion app/mailers/citizen_completed_means_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class CitizenCompletedMeansMailer < BaseApplyMailer
require_relative "concerns/notify_template_methods"
include NotifyTemplateMethods

def notify_provider(application_id, provider_name, applicant_name, application_url, to = support_email_address)
def notify_provider(application_id, provider_name, applicant_name, application_url, to = Rails.configuration.x.support_email_address)
application = LegalAidApplication.find(application_id)
template_name :client_completed_means
set_personalisation(
Expand Down
8 changes: 0 additions & 8 deletions app/mailers/concerns/notify_template_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@ def template_ids
@template_ids ||= Rails.configuration.govuk_notify_templates
end

def support_email_address
Rails.configuration.x.support_email_address
end

def safe_nil(value)
value || ""
end

def url_expiry_date
(Time.zone.today + 7.days).strftime("%-d %B %Y")
end
Expand Down
64 changes: 0 additions & 64 deletions app/mailers/feedback_mailer.rb

This file was deleted.

2 changes: 1 addition & 1 deletion app/mailers/submit_application_reminder_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def self.eligible_for_delivery?(scheduled_mailing)
!scheduled_mailing.legal_aid_application.state.in?(INELIGIBLE_STATES)
end

def notify_provider(application_id, name, to = support_email_address)
def notify_provider(application_id, name, to = Rails.configuration.x.support_email_address)
application = LegalAidApplication.find(application_id)
template_name :reminder_to_submit_an_application
set_personalisation(
Expand Down
62 changes: 0 additions & 62 deletions spec/mailers/feedback_mailer_spec.rb

This file was deleted.

29 changes: 0 additions & 29 deletions spec/requests/feedbacks_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,6 @@
["/feedback/new"]
end

it "schedules an email without an application id" do
expect { post_request }.to change(ScheduledMailing, :count).by(1)
rec = ScheduledMailing.first

expect(rec.mailer_klass).to eq "FeedbackMailer"
expect(rec.mailer_method).to eq "notify"
expect(rec.legal_aid_application_id).to be_nil
expect(rec.addressee).to eq Rails.configuration.x.support_email_address
expect(rec.arguments).to eq [feedback.id, nil]
expect(rec.scheduled_at).to have_been_in_the_past
end

it "adds provider-specific data to feedback record" do
post_request
expect(feedback.source).to eq "Provider"
Expand Down Expand Up @@ -154,18 +142,6 @@
end
end

it "schedules an email" do
expect { post_request }.to change(ScheduledMailing, :count).by(1)
rec = ScheduledMailing.first

expect(rec.mailer_klass).to eq "FeedbackMailer"
expect(rec.mailer_method).to eq "notify"
expect(rec.legal_aid_application_id).to eq application.id
expect(rec.addressee).to eq Rails.configuration.x.support_email_address
expect(rec.arguments).to eq [feedback.id, application.id]
expect(rec.scheduled_at < Time.zone.now).to be true
end

it "redirects to show action" do
post_request
expect(response.body).to include(I18n.t(".feedback.show.title"))
Expand All @@ -178,11 +154,6 @@
expect { post_request }.not_to change(Feedback, :count)
end

it "does not send an email" do
expect(FeedbackMailer).not_to receive(:notify)
post_request
end

it "shows errors on the page" do
post_request
expect(unescaped_response_body).to include(I18n.t(".activerecord.errors.models.feedback.attributes.satisfaction.blank"))
Expand Down

0 comments on commit a38af6c

Please sign in to comment.