diff options
author | Matthew Somerville <matthew@mysociety.org> | 2019-10-21 13:38:01 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2019-10-28 11:35:20 +0000 |
commit | 1022f0672adfaaab85e3e2d2ca1adddc6ea706dd (patch) | |
tree | 28e0ac2a54be7f39007b38b4bf35d535b8a2ff5a /perllib/FixMyStreet/Cobrand/Peterborough.pm | |
parent | 64687c93beffc07d0fcb10459e5a898544bf8aae (diff) |
[UK] Factor out Confirm open311_config to role.
Diffstat (limited to 'perllib/FixMyStreet/Cobrand/Peterborough.pm')
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Peterborough.pm | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Peterborough.pm b/perllib/FixMyStreet/Cobrand/Peterborough.pm index 9aa807cda..dd9bb0670 100644 --- a/perllib/FixMyStreet/Cobrand/Peterborough.pm +++ b/perllib/FixMyStreet/Cobrand/Peterborough.pm @@ -5,6 +5,7 @@ use strict; use warnings; use Moo; +with 'FixMyStreet::Roles::ConfirmOpen311'; with 'FixMyStreet::Roles::ConfirmValidation'; sub council_area_id { 2566 } @@ -34,35 +35,16 @@ sub geocoder_munge_results { sub admin_user_domain { "peterborough.gov.uk" } -sub open311_config { - my ($self, $row, $h, $params) = @_; - - my $extra = $row->get_extra_fields; - push @$extra, - { name => 'report_url', - value => $h->{url} }, - { name => 'title', - value => $row->title }, - { name => 'description', - value => $row->detail }; +around 'open311_config' => sub { + my ($orig, $self, $row, $h, $params) = @_; # remove the emergency category which is informational only + my $extra = $row->get_extra_fields; @$extra = grep { $_->{name} ne 'emergency' } @$extra; - - # Reports made via FMS.com or the app probably won't have a site code - # value because we don't display the adopted highways layer on those - # frontends. Instead we'll look up the closest asset from the WFS - # service at the point we're sending the report over Open311. - if (!$row->get_extra_field_value('site_code')) { - if (my $site_code = $self->lookup_site_code($row)) { - push @$extra, - { name => 'site_code', - value => $site_code }; - } - } - $row->set_extra_fields(@$extra); -} + + $self->$orig($row, $h, $params); +}; sub lookup_site_code_config { { buffer => 50, # metres |