aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/Cobrand/Buckinghamshire.pm9
-rw-r--r--t/cobrand/bucks.t14
2 files changed, 15 insertions, 8 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm b/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm
index bb4b76170..f1dd85176 100644
--- a/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm
+++ b/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm
@@ -88,11 +88,12 @@ sub open311_post_send {
return unless $row->external_id;
# For certain categories, send an email also
+ my $emails = $self->feature('open311_email');
my $addresses = {
- 'Flytipping' => [ join('@', 'illegaldumpingcosts', $self->admin_user_domain), "TfB" ],
- 'Blocked drain' => [ join('@', 'floodmanagement', $self->admin_user_domain), "Flood Management" ],
- 'Ditch issue' => [ join('@', 'floodmanagement', $self->admin_user_domain), "Flood Management" ],
- 'Flooded subway' => [ join('@', 'floodmanagement', $self->admin_user_domain), "Flood Management" ],
+ 'Flytipping' => [ $emails->{flytipping}, "TfB" ],
+ 'Blocked drain' => [ $emails->{flood}, "Flood Management" ],
+ 'Ditch issue' => [ $emails->{flood}, "Flood Management" ],
+ 'Flooded subway' => [ $emails->{flood}, "Flood Management" ],
};
my $dest = $addresses->{$row->category};
return unless $dest;
diff --git a/t/cobrand/bucks.t b/t/cobrand/bucks.t
index 2d42dcd81..a3ae3a196 100644
--- a/t/cobrand/bucks.t
+++ b/t/cobrand/bucks.t
@@ -27,6 +27,14 @@ FixMyStreet::override_config {
ALLOWED_COBRANDS => [ 'buckinghamshire', 'fixmystreet' ],
MAPIT_URL => 'http://mapit.uk/',
STAGING_FLAGS => { send_reports => 1, skip_checks => 0 },
+ COBRAND_FEATURES => {
+ open311_email => {
+ buckinghamshire => {
+ flytipping => 'flytipping@example.org',
+ flood => 'floods@example.org',
+ }
+ }
+ }
}, sub {
subtest 'cobrand displays council name' => sub {
@@ -54,8 +62,7 @@ my ($report) = $mech->create_problems_for_body(1, $body->id, 'On Road', {
subtest 'flytipping on road sent to extra email' => sub {
FixMyStreet::Script::Reports::send();
my @email = $mech->get_email;
- my $tfb = join('', 'illegaldumpingcosts', '@', 'buckscc.gov.uk');
- is $email[0]->header('To'), 'TfB <' . $tfb . '>';
+ is $email[0]->header('To'), 'TfB <flytipping@example.org>';
like $mech->get_text_body_from_email($email[1]), qr/report's reference number/;
$report->discard_changes;
is $report->external_id, 248, 'Report has right external ID';
@@ -101,8 +108,7 @@ subtest 'blocked drain sent to extra email' => sub {
$mech->clear_emails_ok;
FixMyStreet::Script::Reports::send();
my @email = $mech->get_email;
- my $e = join('@', 'floodmanagement', 'buckscc.gov.uk');
- is $email[0]->header('To'), '"Flood Management" <' . $e . '>';
+ is $email[0]->header('To'), '"Flood Management" <floods@example.org>';
like $mech->get_text_body_from_email($email[1]), qr/report's reference number/;
};