diff options
author | Matthew Somerville <matthew@mysociety.org> | 2020-03-18 13:13:13 +0000 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2020-03-31 09:58:58 +0100 |
commit | 2187335bcd3fff4e0199e25d381d9f9d865e85c9 (patch) | |
tree | 8f361815b629c972049cde1134451687f28dfce5 | |
parent | ce5e3e3ffd4489f3197d9e473f79d539f925b88c (diff) |
[Highways England] Ignore HE wherever TfL is.
-rw-r--r-- | perllib/FixMyStreet/Cobrand/UK.pm | 4 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/UKCouncils.pm | 8 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Body.pm | 2 |
3 files changed, 8 insertions, 6 deletions
diff --git a/perllib/FixMyStreet/Cobrand/UK.pm b/perllib/FixMyStreet/Cobrand/UK.pm index 512dfa973..a42ff58a6 100644 --- a/perllib/FixMyStreet/Cobrand/UK.pm +++ b/perllib/FixMyStreet/Cobrand/UK.pm @@ -364,9 +364,11 @@ sub get_body_handler_for_problem { if ($row->to_body_named('TfL')) { return FixMyStreet::Cobrand::TfL->new; } + # Do not do anything for Highways England here, as we don't want it to + # treat this as a cobrand for e.g. submit report emails made on .com my @bodies = values %{$row->bodies}; - my %areas = map { %{$_->areas} } grep { $_->name ne 'TfL' } @bodies; + my %areas = map { %{$_->areas} } grep { $_->name !~ /TfL|Highways England/ } @bodies; my $cobrand = FixMyStreet::Cobrand->body_handler(\%areas); return $cobrand if $cobrand; diff --git a/perllib/FixMyStreet/Cobrand/UKCouncils.pm b/perllib/FixMyStreet/Cobrand/UKCouncils.pm index 64c22d543..8cc7d90e0 100644 --- a/perllib/FixMyStreet/Cobrand/UKCouncils.pm +++ b/perllib/FixMyStreet/Cobrand/UKCouncils.pm @@ -49,10 +49,10 @@ sub restriction { } # UK cobrands assume that each MapIt area ID maps both ways with one -# body. Except TfL. +# body. Except TfL and Highways England. sub body { my $self = shift; - my $body = FixMyStreet::DB->resultset('Body')->for_areas($self->council_area_id)->search({ name => { '!=', 'TfL' } })->first; + my $body = FixMyStreet::DB->resultset('Body')->for_areas($self->council_area_id)->search({ name => { 'not_in', ['TfL', 'Highways England'] } })->first; return $body; } @@ -239,8 +239,8 @@ sub owns_problem { } else { # Object @bodies = values %{$report->bodies}; } - # Want to ignore the TfL body that covers London councils - my %areas = map { %{$_->areas} } grep { $_->name ne 'TfL' } @bodies; + # Want to ignore the TfL body that covers London councils, and HE that is all England + my %areas = map { %{$_->areas} } grep { $_->name !~ /TfL|Highways England/ } @bodies; return $areas{$self->council_area_id} ? 1 : undef; } diff --git a/perllib/FixMyStreet/DB/Result/Body.pm b/perllib/FixMyStreet/DB/Result/Body.pm index 05d6bfcab..95debc910 100644 --- a/perllib/FixMyStreet/DB/Result/Body.pm +++ b/perllib/FixMyStreet/DB/Result/Body.pm @@ -229,7 +229,7 @@ sub cobrand_name { # Bromley Council" when making a report within Westminster on the TfL # cobrand. # If the current body is TfL then we always want to show TfL as the cobrand name. - return $self->name if $self->name eq 'TfL'; + return $self->name if $self->name eq 'TfL' || $self->name eq 'Highways England'; my $handler = $self->get_cobrand_handler; if ($handler && $handler->can('council_name')) { |