aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
authorM Somerville <matthew-github@dracos.co.uk>2020-11-10 14:53:48 +0000
committerM Somerville <matthew-github@dracos.co.uk>2020-11-10 14:53:48 +0000
commit808f4d7c18f2c3a1b776900820e604d896072499 (patch)
tree2bc9c91d401f1edaf145b7127fb3d84ba53f5752 /perllib
parent6f6a65c8d2076cc20c11ae290c9603ea3c4fe41c (diff)
[Highways England] Added test for config reading.
Diffstat (limited to 'perllib')
-rw-r--r--perllib/FixMyStreet/SendReport/Email/Highways.pm7
1 files changed, 6 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/SendReport/Email/Highways.pm b/perllib/FixMyStreet/SendReport/Email/Highways.pm
index 918ac896d..3ace07b6a 100644
--- a/perllib/FixMyStreet/SendReport/Email/Highways.pm
+++ b/perllib/FixMyStreet/SendReport/Email/Highways.pm
@@ -12,8 +12,13 @@ sub build_recipient_list {
my $contact = $self->fetch_category($body, $row) or return;
my $email = $contact->email;
my $area_name = $row->get_extra_field_value('area_name') || '';
+
+ # config is read-only, so must step through one-by-one to prevent
+ # vivification
my $area_email = FixMyStreet->config('COBRAND_FEATURES') || {};
- $area_email = $area_email->{open311_email}->{highwaysengland}->{$area_name};
+ $area_email = $area_email->{open311_email} || {};
+ $area_email = $area_email->{highwaysengland} || {};
+ $area_email = $area_email->{$area_name};
$email = $area_email if $area_email;
@{$self->to} = map { [ $_, $body->name ] } split /,/, $email;