aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/Cobrand/Bexley.pm7
-rw-r--r--t/cobrand/bexley.t6
2 files changed, 7 insertions, 6 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Bexley.pm b/perllib/FixMyStreet/Cobrand/Bexley.pm
index 5539e8bfc..0fbb8944b 100644
--- a/perllib/FixMyStreet/Cobrand/Bexley.pm
+++ b/perllib/FixMyStreet/Cobrand/Bexley.pm
@@ -110,7 +110,7 @@ sub open311_post_send {
if ($row->category eq 'Parks and open spaces') {
$p1_email = 1 if $reportType =~ /locked in a park|Wild animal/;
$p1_email = 1 if $dangerous eq 'Yes' && $reportType =~ /Playgrounds|park furniture|gates are broken|Vandalism|Other/;
- } else {
+ } elsif (!$lighting{$row->category}) {
$p1_email = 1 if $dangerous eq 'Yes';
}
@@ -118,8 +118,9 @@ sub open311_post_send {
if ($row->category eq 'Abandoned and untaxed vehicles' || $row->category eq 'Dead animal' || $p1_email) {
push @to, [ $emails->{p1}, 'Bexley P1 email' ] if $emails->{p1};
}
- if ($lighting{$row->category}) {
- push @to, [ $emails->{lighting}, 'FixMyStreet Bexley Street Lighting' ] if $emails->{lighting};
+ if ($lighting{$row->category} && $emails->{lighting}) {
+ my @lighting = split /,/, $emails->{lighting};
+ push @to, [ $_, 'FixMyStreet Bexley Street Lighting' ] for @lighting;
}
return unless @to;
my $sender = FixMyStreet::SendReport::Email->new( to => \@to );
diff --git a/t/cobrand/bexley.t b/t/cobrand/bexley.t
index 3937129d3..480f1ce2d 100644
--- a/t/cobrand/bexley.t
+++ b/t/cobrand/bexley.t
@@ -45,7 +45,7 @@ FixMyStreet::override_config {
MAPIT_URL => 'http://mapit.uk/',
MAP_TYPE => 'Bexley',
STAGING_FLAGS => { send_reports => 1, skip_checks => 0 },
- COBRAND_FEATURES => { open311_email => { bexley => { p1 => 'p1@bexley', lighting => 'thirdparty@notbexley.example.com' } } },
+ COBRAND_FEATURES => { open311_email => { bexley => { p1 => 'p1@bexley', lighting => 'thirdparty@notbexley.example.com,another@notbexley.example.com' } } },
}, sub {
subtest 'cobrand displays council name' => sub {
@@ -81,9 +81,9 @@ FixMyStreet::override_config {
{ 'name' => 'dangerous', description => 'Was it dangerous?', 'value' => 'Yes' },
{ 'name' => 'reportType', description => 'Type of report', 'value' => 'Vandalism' },
] },
- { category => 'Lamp post', code => 'LAMP', email => 'thirdparty',
+ { category => 'Lamp post', code => 'LAMP', email => 'thirdparty.*another',
extra => { 'name' => 'dangerous', description => 'Was it dangerous?', 'value' => 'No' } },
- { category => 'Lamp post', code => 'LAMP', email => 'p1.*thirdparty',
+ { category => 'Lamp post', code => 'LAMP', email => 'thirdparty.*another',
extra => { 'name' => 'dangerous', description => 'Was it dangerous?', 'value' => 'Yes' } },
) {
($report) = $mech->create_problems_for_body(1, $body->id, 'On Road', {