diff options
author | Matthew Somerville <matthew@mysociety.org> | 2019-06-12 11:45:18 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2019-06-12 11:45:18 +0100 |
commit | bc7b2c5b5538ab9e59a2955a87c75b2156b7ec63 (patch) | |
tree | ccf91ff99bbd25539e551f539204b80fd785627b | |
parent | a803781aee299f9cfeb4551ee398701cc053a7a5 (diff) | |
parent | 162351e8f31779ef216b0e8a6ab0332590adecc9 (diff) |
Merge branch 'uk-to-features'
-rw-r--r-- | perllib/FixMyStreet/Cobrand/BathNES.pm | 15 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Bexley.pm | 13 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Borsetshire.pm | 4 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Bristol.pm | 15 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Bromley.pm | 16 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Buckinghamshire.pm | 15 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/EastHerts.pm | 16 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Greenwich.pm | 15 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Hart.pm | 10 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Hounslow.pm | 12 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Lincolnshire.pm | 17 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Northamptonshire.pm | 13 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Oxfordshire.pm | 15 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Rutland.pm | 4 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Stevenage.pm | 15 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/UKCouncils.pm | 21 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Warwickshire.pm | 10 | ||||
-rw-r--r-- | t/cobrand/bexley.t | 16 |
18 files changed, 32 insertions, 210 deletions
diff --git a/perllib/FixMyStreet/Cobrand/BathNES.pm b/perllib/FixMyStreet/Cobrand/BathNES.pm index e26e846c3..d726c671e 100644 --- a/perllib/FixMyStreet/Cobrand/BathNES.pm +++ b/perllib/FixMyStreet/Cobrand/BathNES.pm @@ -17,27 +17,12 @@ sub council_area { return 'Bath and North East Somerset'; } sub council_name { return 'Bath and North East Somerset Council'; } sub council_url { return 'bathnes'; } -sub contact_email { - my $self = shift; - return join( '@', 'councilconnect_rejections', 'bathnes.gov.uk' ); -} - sub admin_user_domain { 'bathnes.gov.uk' } -sub base_url { - my $self = shift; - return $self->next::method() if FixMyStreet->config('STAGING_SITE'); - return 'https://fix.bathnes.gov.uk'; -} - sub map_type { 'BathNES' } sub on_map_default_status { 'open' } -sub example_places { - return ( 'BA1 1JQ', "Lansdown Grove" ); -} - sub get_geocoder { return 'OSM'; # default of Bing gives poor results, let's try overriding. } diff --git a/perllib/FixMyStreet/Cobrand/Bexley.pm b/perllib/FixMyStreet/Cobrand/Bexley.pm index c89fd9895..727382ec0 100644 --- a/perllib/FixMyStreet/Cobrand/Bexley.pm +++ b/perllib/FixMyStreet/Cobrand/Bexley.pm @@ -8,19 +8,11 @@ sub council_area_id { 2494 } sub council_area { 'Bexley' } sub council_name { 'London Borough of Bexley' } sub council_url { 'bexley' } -sub example_places { ( 'DA6 7AT', "Chieveley Road" ) } sub get_geocoder { 'OSM' } sub enable_category_groups { 1 } sub suggest_duplicates { 1 } -sub base_url { - my $self = shift; - return $self->next::method() if FixMyStreet->config('STAGING_SITE'); - # uncoverable statement - return 'https://fix.bexley.gov.uk'; -} - sub disambiguate_location { my $self = shift; my $string = shift; @@ -34,11 +26,6 @@ sub disambiguate_location { sub on_map_default_status { 'open' } -sub contact_email { - my $self = shift; - return join( '@', 'customer.services', $self->council_url . '.gov.uk' ); -} - sub open311_munge_update_params { my ($self, $params, $comment, $body) = @_; diff --git a/perllib/FixMyStreet/Cobrand/Borsetshire.pm b/perllib/FixMyStreet/Cobrand/Borsetshire.pm index 44a4a9162..a99d2e7b4 100644 --- a/perllib/FixMyStreet/Cobrand/Borsetshire.pm +++ b/perllib/FixMyStreet/Cobrand/Borsetshire.pm @@ -9,10 +9,6 @@ sub council_area { return 'Borsetshire'; } sub council_name { return 'Borsetshire County Council'; } sub council_url { return 'demo'; } -sub example_places { - return ( 'BS36 2NS', 'Coalpit Heath' ); -} - sub pin_colour { my ( $self, $p, $context ) = @_; return 'grey' if $p->is_closed; diff --git a/perllib/FixMyStreet/Cobrand/Bristol.pm b/perllib/FixMyStreet/Cobrand/Bristol.pm index fa2d3fabb..177e2172b 100644 --- a/perllib/FixMyStreet/Cobrand/Bristol.pm +++ b/perllib/FixMyStreet/Cobrand/Bristol.pm @@ -9,16 +9,6 @@ sub council_area { return 'Bristol'; } sub council_name { return 'Bristol County Council'; } sub council_url { return 'bristol'; } -sub base_url { - my $self = shift; - return $self->next::method() if FixMyStreet->config('STAGING_SITE'); - return 'https://fixmystreet.bristol.gov.uk'; -} - -sub example_places { - return ( 'BS1 5TR', "Broad Quay" ); -} - sub map_type { 'Bristol'; } @@ -50,11 +40,6 @@ sub pin_colour { return 'yellow'; } -sub contact_email { - my $self = shift; - return join( '@', 'customer.services', 'bristol.gov.uk' ); -} - sub send_questionnaires { return 0; } diff --git a/perllib/FixMyStreet/Cobrand/Bromley.pm b/perllib/FixMyStreet/Cobrand/Bromley.pm index 986836b2f..ce7c0971f 100644 --- a/perllib/FixMyStreet/Cobrand/Bromley.pm +++ b/perllib/FixMyStreet/Cobrand/Bromley.pm @@ -33,12 +33,6 @@ sub report_new_munge_before_insert { $report->subcategory($report->get_extra_field_value('service_sub_code')); } -sub base_url { - my $self = shift; - return $self->next::method() if FixMyStreet->config('STAGING_SITE'); - return 'https://fix.bromley.gov.uk'; -} - sub problems_on_map_restriction { my ($self, $rs) = @_; return $rs if FixMyStreet->staging_flag('skip_checks'); @@ -87,10 +81,6 @@ sub get_geocoder { return 'OSM'; # default of Bing gives poor results, let's try overriding. } -sub example_places { - return ( 'BR1 3UH', 'Glebe Rd, Bromley' ); -} - sub map_type { 'Bromley'; } @@ -121,12 +111,6 @@ sub process_open311_extras { $self->SUPER::process_open311_extras( @_, [ 'first_name', 'last_name' ] ); } -sub contact_email { - my $self = shift; - return join( '@', 'info', 'bromley.gov.uk' ); -} -sub contact_name { 'Bromley Council (do not reply)'; } - sub abuse_reports_only { 1; } sub reports_per_page { return 20; } diff --git a/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm b/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm index 6a6da22b6..bf77b5cf1 100644 --- a/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm +++ b/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm @@ -12,16 +12,6 @@ sub council_area { return 'Buckinghamshire'; } sub council_name { return 'Buckinghamshire County Council'; } sub council_url { return 'buckinghamshire'; } -sub example_places { - return ( 'HP19 7QF', "Walton Road" ); -} - -sub base_url { - my $self = shift; - return $self->next::method() if FixMyStreet->config('STAGING_SITE'); - return 'https://fixmystreet.buckscc.gov.uk'; -} - sub disambiguate_location { my $self = shift; my $string = shift; @@ -53,11 +43,6 @@ sub pin_colour { sub admin_user_domain { 'buckscc.gov.uk' } -sub contact_email { - my $self = shift; - return join( '@', 'fixmystreetbs', 'email.buckscc.gov.uk' ); -} - sub send_questionnaires { return 0; } diff --git a/perllib/FixMyStreet/Cobrand/EastHerts.pm b/perllib/FixMyStreet/Cobrand/EastHerts.pm index 0e60c6b08..806f9cc3c 100644 --- a/perllib/FixMyStreet/Cobrand/EastHerts.pm +++ b/perllib/FixMyStreet/Cobrand/EastHerts.pm @@ -9,22 +9,11 @@ sub council_area { return 'East Hertfordshire'; } sub council_name { return 'East Hertfordshire District Council'; } sub council_url { return 'eastherts'; } -sub base_url { - my $self = shift; - return $self->next::method() if FixMyStreet->config('STAGING_SITE'); - return 'https://fixmystreet.eastherts.gov.uk'; -} - - sub enter_postcode_text { my ($self) = @_; return 'Enter an ' . $self->council_area . ' postcode, or street name and area'; } -sub example_places { - return ( 'SG14 2AP', "Mangrove Road" ); -} - sub disambiguate_location { my $self = shift; my $string = shift; @@ -46,9 +35,4 @@ sub pin_colour { return 'yellow'; } -sub contact_email { - my $self = shift; - return join( '@', 'enquiries', 'eastherts.gov.uk' ); -} - 1; diff --git a/perllib/FixMyStreet/Cobrand/Greenwich.pm b/perllib/FixMyStreet/Cobrand/Greenwich.pm index 2aaa5d776..757692f48 100644 --- a/perllib/FixMyStreet/Cobrand/Greenwich.pm +++ b/perllib/FixMyStreet/Cobrand/Greenwich.pm @@ -9,16 +9,6 @@ sub council_area { return 'Greenwich'; } sub council_name { return 'Royal Borough of Greenwich'; } sub council_url { return 'greenwich'; } -sub base_url { - my $self = shift; - return $self->next::method() if FixMyStreet->config('STAGING_SITE'); - return 'https://fix.royalgreenwich.gov.uk'; -} - -sub example_places { - return ( 'SE18 6HQ', "Woolwich Road" ); -} - sub enter_postcode_text { my ($self) = @_; return 'Enter a Royal Greenwich postcode, or street name and area'; @@ -50,11 +40,6 @@ sub pin_colour { return 'yellow'; } -sub contact_email { - my $self = shift; - return join( '@', 'fixmystreet', 'royalgreenwich.gov.uk' ); -} - sub reports_per_page { return 20; } sub open311_config { diff --git a/perllib/FixMyStreet/Cobrand/Hart.pm b/perllib/FixMyStreet/Cobrand/Hart.pm index 3ff2a2a19..24a358ab8 100644 --- a/perllib/FixMyStreet/Cobrand/Hart.pm +++ b/perllib/FixMyStreet/Cobrand/Hart.pm @@ -26,10 +26,6 @@ sub disambiguate_location { }; } -sub example_places { - return ( 'GU51 4JX', 'Primrose Drive' ); -} - sub categories_restriction { my ($self, $rs) = @_; return $rs->search( { category => { '!=' => 'Graffiti on bridges/subways' } } ); @@ -43,12 +39,6 @@ sub ask_ever_reported { return 0; } -sub contact_email { - my $self = shift; - return join( '@', 'info', 'hart.gov.uk' ); -} -sub contact_name { 'Hart District Council (do not reply)'; } - sub default_map_zoom { 3 } sub reports_per_page { return 20; } diff --git a/perllib/FixMyStreet/Cobrand/Hounslow.pm b/perllib/FixMyStreet/Cobrand/Hounslow.pm index 491384847..1628715c6 100644 --- a/perllib/FixMyStreet/Cobrand/Hounslow.pm +++ b/perllib/FixMyStreet/Cobrand/Hounslow.pm @@ -8,16 +8,9 @@ sub council_area_id { 2483 } sub council_area { 'Hounslow' } sub council_name { 'Hounslow Highways' } sub council_url { 'hounslow' } -sub example_places { ( 'TW3 1SN', "Depot Road" ) } sub map_type { 'Hounslow' } -sub base_url { - my $self = shift; - return $self->next::method() if FixMyStreet->config('STAGING_SITE'); - return 'https://fms.hounslowhighways.org'; -} - sub enter_postcode_text { my ($self) = @_; return "Enter a Hounslow street name and area, or postcode"; @@ -52,11 +45,6 @@ sub get_geocoder { sub on_map_default_status { 'open' } -sub contact_email { - my $self = shift; - return join( '@', 'enquiries', $self->council_url . 'highways.org' ); -} - sub send_questionnaires { 0 } sub enable_category_groups { 1 } diff --git a/perllib/FixMyStreet/Cobrand/Lincolnshire.pm b/perllib/FixMyStreet/Cobrand/Lincolnshire.pm index 2506772b3..2cb1844c6 100644 --- a/perllib/FixMyStreet/Cobrand/Lincolnshire.pm +++ b/perllib/FixMyStreet/Cobrand/Lincolnshire.pm @@ -29,23 +29,6 @@ sub enter_postcode_text { return 'Enter a Lincolnshire postcode, street name and area, or check an existing report number'; } - -sub base_url { - my $self = shift; - return $self->next::method() if FixMyStreet->config('STAGING_SITE'); - return 'https://fixmystreet.lincolnshire.gov.uk'; -} - -sub contact_email { - my $self = shift; - return join( '@', 'confirm_support', 'lincolnshire.gov.uk' ); -} - - -sub example_places { - return ( 'LN1 1YL', 'Orchard Street, Lincoln' ); -} - sub disambiguate_location { my $self = shift; my $string = shift; diff --git a/perllib/FixMyStreet/Cobrand/Northamptonshire.pm b/perllib/FixMyStreet/Cobrand/Northamptonshire.pm index 683dc059c..3d5d4b6f2 100644 --- a/perllib/FixMyStreet/Cobrand/Northamptonshire.pm +++ b/perllib/FixMyStreet/Cobrand/Northamptonshire.pm @@ -12,16 +12,8 @@ sub council_area { 'Northamptonshire' } sub council_name { 'Northamptonshire County Council' } sub council_url { 'northamptonshire' } -sub example_places { ( 'NN1 1NS', "Bridge Street" ) } - sub enter_postcode_text { 'Enter a Northamptonshire postcode, street name and area, or check an existing report number' } -sub base_url { - my $self = shift; - return $self->next::method() if FixMyStreet->config('STAGING_SITE'); - return 'https://fixmystreet.northamptonshire.gov.uk'; -} - sub disambiguate_location { my $self = shift; my $string = shift; @@ -51,11 +43,6 @@ sub problems_on_map_restriction { return $self->problems_restriction($rs); } -sub contact_email { - my $self = shift; - return join( '@', 'highways', $self->council_url . '.gov.uk' ); -} - sub privacy_policy_url { 'https://www3.northamptonshire.gov.uk/councilservices/council-and-democracy/transparency/information-policies/privacy-notice/place/Pages/street-doctor.aspx' } diff --git a/perllib/FixMyStreet/Cobrand/Oxfordshire.pm b/perllib/FixMyStreet/Cobrand/Oxfordshire.pm index 845536bb1..72a56f46c 100644 --- a/perllib/FixMyStreet/Cobrand/Oxfordshire.pm +++ b/perllib/FixMyStreet/Cobrand/Oxfordshire.pm @@ -37,12 +37,6 @@ sub is_council_with_case_management { return FixMyStreet->config('STAGING_SITE'); } -sub base_url { - my $self = shift; - return $self->next::method() if FixMyStreet->config('STAGING_SITE'); - return 'https://fixmystreet.oxfordshire.gov.uk'; -} - sub enter_postcode_text { my ($self) = @_; return 'Enter an Oxfordshire postcode, or street name and area'; @@ -60,10 +54,6 @@ sub disambiguate_location { }; } -sub example_places { - return ( 'OX20 1SZ', 'Park St, Woodstock' ); -} - # don't send questionnaires to people who used the OCC cobrand to report their problem sub send_questionnaires { return 0; } @@ -156,11 +146,6 @@ sub should_skip_sending_update { sub on_map_default_status { return 'open'; } -sub contact_email { - my $self = shift; - return join( '@', 'highway.enquiries', 'oxfordshire.gov.uk' ); -} - sub admin_user_domain { 'oxfordshire.gov.uk' } sub traffic_management_options { diff --git a/perllib/FixMyStreet/Cobrand/Rutland.pm b/perllib/FixMyStreet/Cobrand/Rutland.pm index af635ac59..407d43d14 100644 --- a/perllib/FixMyStreet/Cobrand/Rutland.pm +++ b/perllib/FixMyStreet/Cobrand/Rutland.pm @@ -35,10 +35,6 @@ sub open311_config { $params->{multi_photos} = 1; } -sub example_places { - return ( 'LE15 6HP', 'High Street', 'Oakham' ); -} - sub disambiguate_location { my $self = shift; my $string = shift; diff --git a/perllib/FixMyStreet/Cobrand/Stevenage.pm b/perllib/FixMyStreet/Cobrand/Stevenage.pm index 28734b14b..9b0e91016 100644 --- a/perllib/FixMyStreet/Cobrand/Stevenage.pm +++ b/perllib/FixMyStreet/Cobrand/Stevenage.pm @@ -10,12 +10,6 @@ sub council_name { return 'Stevenage Council'; } sub council_url { return 'stevenage'; } sub is_two_tier { return 1; } -sub base_url { - my $self = shift; - return $self->next::method() if FixMyStreet->config('STAGING_SITE'); - return 'http://fixmystreet.stevenage.gov.uk'; -} - sub disambiguate_location { my $self = shift; return { @@ -27,18 +21,9 @@ sub disambiguate_location { }; } -sub example_places { - return [ 'SG1 1HN', 'Lyton Way' ]; -} - sub default_map_zoom { return 3; } sub users_can_hide { return 1; } -sub contact_email { - my $self = shift; - return join( '@', 'csc', 'stevenage.gov.uk' ); -} - 1; diff --git a/perllib/FixMyStreet/Cobrand/UKCouncils.pm b/perllib/FixMyStreet/Cobrand/UKCouncils.pm index c21ed6401..f17593095 100644 --- a/perllib/FixMyStreet/Cobrand/UKCouncils.pm +++ b/perllib/FixMyStreet/Cobrand/UKCouncils.pm @@ -110,7 +110,11 @@ sub users_restriction { sub base_url { my $self = shift; - my $base_url = FixMyStreet->config('BASE_URL'); + + my $base_url = $self->feature('base_url'); + return $base_url if $base_url; + + $base_url = FixMyStreet->config('BASE_URL'); my $u = $self->council_url; if ( $base_url !~ /$u/ ) { $base_url =~ s{(https?://)(?!www\.)}{$1$u.}g; @@ -119,6 +123,11 @@ sub base_url { return $base_url; } +sub example_places { + my $self = shift; + return $self->feature('example_places') || $self->next::method(); +} + sub enter_postcode_text { my ($self) = @_; return 'Enter a ' . $self->council_area . ' postcode, or street name and area'; @@ -325,6 +334,16 @@ sub lookup_site_code { return $site_code; } +sub contact_name { + my $self = shift; + return $self->feature('contact_name') || $self->next::method(); +} + +sub contact_email { + my $self = shift; + return $self->feature('contact_email') || $self->next::method(); +} + sub extra_contact_validation { my $self = shift; my $c = shift; diff --git a/perllib/FixMyStreet/Cobrand/Warwickshire.pm b/perllib/FixMyStreet/Cobrand/Warwickshire.pm index c301450bc..ff28bc8b3 100644 --- a/perllib/FixMyStreet/Cobrand/Warwickshire.pm +++ b/perllib/FixMyStreet/Cobrand/Warwickshire.pm @@ -22,16 +22,6 @@ sub disambiguate_location { }; } -sub example_places { - return [ 'CV34 4RL', 'Stratford Rd' ]; -} - -sub contact_email { - my $self = shift; - return join( '@', 'fmstest', 'warwickshire.gov.uk' ); -} -sub contact_name { 'Warwickshire County Council (do not reply)'; } - sub send_questionnaires { 0 } sub open311_contact_meta_override { diff --git a/t/cobrand/bexley.t b/t/cobrand/bexley.t index e6f400e3d..2f74ac03a 100644 --- a/t/cobrand/bexley.t +++ b/t/cobrand/bexley.t @@ -12,10 +12,18 @@ $ukc->mock('lookup_site_code', sub { return "Road ID"; }); -my $cobrand = FixMyStreet::Cobrand::Bexley->new; -like $cobrand->contact_email, qr/bexley/; -is $cobrand->on_map_default_status, 'open'; -is_deeply $cobrand->disambiguate_location->{bounds}, [ 51.408484, 0.074653, 51.515542, 0.2234676 ]; +FixMyStreet::override_config { + COBRAND_FEATURES => { + contact_email => { + bexley => 'foo@bexley', + } + }, +}, sub { + my $cobrand = FixMyStreet::Cobrand::Bexley->new; + like $cobrand->contact_email, qr/bexley/; + is $cobrand->on_map_default_status, 'open'; + is_deeply $cobrand->disambiguate_location->{bounds}, [ 51.408484, 0.074653, 51.515542, 0.2234676 ]; +}; my $mech = FixMyStreet::TestMech->new; |