Skip to content

Commit

Permalink
[Bexley][WW] Waste report emails sent to client are from council no-r…
Browse files Browse the repository at this point in the history
…eply
  • Loading branch information
nephila-nacrea authored and chrismytton committed Jul 23, 2024
1 parent 068c479 commit fba2cd5
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
1 change: 0 additions & 1 deletion perllib/FixMyStreet/SendReport/Email.pm
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ sub build_recipient_list {

sub get_template {
my ( $self, $row ) = @_;

return 'submit.txt';
}

Expand Down
26 changes: 26 additions & 0 deletions perllib/FixMyStreet/SendReport/Email/Bexley.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package FixMyStreet::SendReport::Email::Bexley;

use Moo;

BEGIN { extends 'FixMyStreet::SendReport::Email'; }

has use_verp => ( is => 'ro', default => 0 );

=head2 send_from
Waste emails come from council
=cut

sub send_from {
my ( $self, $row ) = @_;

if ( $row->cobrand_data eq 'waste' ) {
my $cobrand = $row->get_cobrand_logged;
return [ $cobrand->do_not_reply_email, $cobrand->council_name ];
}

$self->SUPER::send_from($row);

Check warning on line 23 in perllib/FixMyStreet/SendReport/Email/Bexley.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/SendReport/Email/Bexley.pm#L23

Added line #L23 was not covered by tests
}

1;
19 changes: 19 additions & 0 deletions t/app/controller/waste_bexley.t
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ my $body = $mech->create_body_ok(
{
comment_user => $comment_user,
send_extended_statuses => 1,
can_be_devolved => 1,
},
{ cobrand => 'bexley' },
);
Expand Down Expand Up @@ -192,6 +193,7 @@ my $contact2 = $mech->create_contact_ok(
email => 'waste-enquiry@example.org',
extra => { type => 'waste' },
group => ['Waste'],
send_method => 'Email::Bexley',
);
$contact2->set_extra_fields(
{
Expand Down Expand Up @@ -1080,6 +1082,8 @@ FixMyStreet::override_config {
};

subtest 'Enquiry form for properties with no collections' => sub {
$mech->delete_problems_for_body( $body->id );

$mech->get_ok('/waste/10006');
$mech->content_contains('/waste/10006/enquiry?template=no-collections', 'link to no collections form present');
$mech->get_ok('/waste/10006/enquiry?template=no-collections');
Expand All @@ -1095,6 +1099,21 @@ FixMyStreet::override_config {
$mech->content_contains('Please review the information you’ve provided before you submit your enquiry.');
$mech->submit_form_ok( { with_fields => { submit => 'Submit' } } );
$mech->content_contains('Nearly done! Now check your email');

my $report = FixMyStreet::DB->resultset('Problem')->first;
$report->confirm;
$report->update;
$mech->clear_emails_ok; # Clear initial confirmation email
FixMyStreet::Script::Reports::send();

$mech->email_count_is(2);
for ($mech->get_email) {
if ( $_->header('To') =~ /waste-enquiry\@example.org/ ) {
is $_->header('From'),
'"London Borough of Bexley" <do-not-reply@example.org>',
'email sent to client is marked as being from council';
}
}
};
};

Expand Down

0 comments on commit fba2cd5

Please sign in to comment.