aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2013-02-08 12:09:27 +0000
committerMatthew Somerville <matthew@mysociety.org>2013-02-08 12:09:27 +0000
commite3bce6312ed59ccd462cae69d214efdb1c19cbbc (patch)
tree35f1cbfe446efaa44cb1b04707c733f2c8a03f37
parent599ff08d1b9e961b97b4fd94f52d6125033d208d (diff)
Send updates to user from body email address (fixes a2a).
-rw-r--r--perllib/FixMyStreet/Cobrand/Zurich.pm6
-rw-r--r--t/cobrand/zurich.t1
2 files changed, 7 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm
index 57181887f..9732e5329 100644
--- a/perllib/FixMyStreet/Cobrand/Zurich.pm
+++ b/perllib/FixMyStreet/Cobrand/Zurich.pm
@@ -444,9 +444,15 @@ sub _admin_send_email {
? [ $problem->user->email, $problem->name ]
: $problem->user->email;
+ # Similar to what SendReport::Zurich does to find address to send to
+ my $body = ( values %{$problem->bodies} )[0];
+ my $sender = $body->endpoint || $c->cobrand->contact_email;
+ my $sender_name = $c->cobrand->contact_name; # $body->name?
+
$c->send_email( $template, {
to => [ $to ],
url => $c->uri_for_email( $problem->url ),
+ from => [ $sender, $sender_name ],
} );
}
diff --git a/t/cobrand/zurich.t b/t/cobrand/zurich.t
index de243eac0..71c904ed9 100644
--- a/t/cobrand/zurich.t
+++ b/t/cobrand/zurich.t
@@ -165,6 +165,7 @@ $mech->content_contains('FINAL UPDATE');
$email = $mech->get_email;
like $email->header('To'), qr/test\@example.com/, 'to line looks correct';
+like $email->header('From'), qr/division\@example.org/, 'from line looks correct';
like $email->body, qr/FINAL UPDATE/, 'body looks correct';
$mech->clear_emails_ok;