aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2020-08-21 13:48:57 +0100
committerStruan Donald <struan@exo.org.uk>2020-09-10 10:53:41 +0100
commit5da5a6ee1f85df8946c795af82b6353a31eb1d97 (patch)
tree0c46c96754c60e53738a96c53ee8f9b224016459
parent4b6baae9c4ac6353357a2f46355aa7eb9c8c10ec (diff)
[UK] enable extra state mapping on .com
-rw-r--r--perllib/FixMyStreet/Cobrand/FixMyStreet.pm13
-rw-r--r--t/cobrand/northamptonshire.t36
2 files changed, 49 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm
index 09f5f5296..7344a0f5e 100644
--- a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm
+++ b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm
@@ -304,6 +304,19 @@ sub updates_disallowed {
return $self->next::method(@_);
}
+sub problem_state_processed {
+ my ($self, $comment) = @_;
+
+ my $state = $comment->problem_state || '';
+ my $code = $comment->get_extra_metadata('external_status_code') || '';
+
+ my ($cfg) = $self->per_body_config('extra_state_mapping', $comment->problem);
+
+ $state = ( $cfg->{$state}->{$code} || $state ) if $cfg->{$state};
+
+ return $state;
+}
+
sub suppress_reporter_alerts {
my $self = shift;
my $c = $self->{c};
diff --git a/t/cobrand/northamptonshire.t b/t/cobrand/northamptonshire.t
index 5758f700f..766922c4a 100644
--- a/t/cobrand/northamptonshire.t
+++ b/t/cobrand/northamptonshire.t
@@ -210,6 +210,42 @@ subtest 'check further investigation state' => sub {
};
$mech->content_contains('Under further investigation');
+
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ { fixmystreet => '.' } ],
+ MAPIT_URL => 'http://mapit.uk/',
+ COBRAND_FEATURES => {
+ extra_state_mapping => {
+ northamptonshire => {
+ fixed => {
+ further => 'Under further investigation'
+ }
+ },
+ fixmystreet => {
+ 'Northamptonshire County Council' => {
+ fixed => {
+ further => 'Under further investigation'
+ }
+ }
+ }
+ }
+ }
+ }, sub {
+ $mech->get_ok('/report/' . $comment->problem_id);
+ };
+
+ $mech->content_contains('Investigating');
+ $mech->content_lacks('Under further investigation');
+
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ { fixmystreet => '.' } ],
+ MAPIT_URL => 'http://mapit.uk/',
+ }, sub {
+ $mech->get_ok('/report/' . $comment->problem_id);
+ };
+
+ $mech->content_contains('Investigating');
+ $mech->content_lacks('Under further investigation');
};
subtest 'check pin colour / reference shown' => sub {