diff options
author | Struan Donald <struan@exo.org.uk> | 2019-07-16 13:36:46 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2019-09-27 17:35:15 +0100 |
commit | 3e82f19d86ca2c7766c85b189a568b1f84082d80 (patch) | |
tree | f84d282872927e7dadbb5cd1b94885164f44892f | |
parent | 95b1ed2d8ec5b668cee8a998810e45908a9598a7 (diff) |
[IsleOfWight] check name correct for private categories
-rw-r--r-- | .cypress/cypress/integration/isleofwight.js | 2 | ||||
-rwxr-xr-x | bin/fixmystreet.com/fixture | 10 | ||||
-rw-r--r-- | web/cobrands/isleofwight/js.js | 13 |
3 files changed, 19 insertions, 6 deletions
diff --git a/.cypress/cypress/integration/isleofwight.js b/.cypress/cypress/integration/isleofwight.js index 430bd0aa8..bc88807ec 100644 --- a/.cypress/cypress/integration/isleofwight.js +++ b/.cypress/cypress/integration/isleofwight.js @@ -15,5 +15,7 @@ describe('When you look at the Island Roads site', function() { cy.wait('@report-ajax'); cy.get('select:eq(4)').select('Potholes'); cy.contains('sent to Island Roads'); + cy.get('select:eq(4)').select('Private'); + cy.contains('sent to Island Roads'); }); }); diff --git a/bin/fixmystreet.com/fixture b/bin/fixmystreet.com/fixture index 98556393e..1340858a4 100755 --- a/bin/fixmystreet.com/fixture +++ b/bin/fixmystreet.com/fixture @@ -99,7 +99,7 @@ if ($opt->test_fixtures) { { area_id => 2257, categories => ['Flytipping', 'Graffiti'], name => 'Chiltern District Council' }, { area_id => 2397, categories => [ 'Graffiti' ], name => 'Northampton Borough Council' }, { area_id => 2483, categories => [ 'Potholes', 'Other' ], name => 'Hounslow Borough Council' }, - { area_id => 2636, categories => [ 'Potholes' ], name => 'Isle of Wight Council' }, + { area_id => 2636, categories => [ 'Potholes', 'Private' ], name => 'Isle of Wight Council' }, ) { $bodies->{$_->{area_id}} = FixMyStreet::DB::Factory::Body->find_or_create($_); my $cats = join(', ', @{$_->{categories}}); @@ -145,6 +145,14 @@ if ($opt->test_fixtures) { $child_cat->update({ non_public => 1 }); + + $child_cat = FixMyStreet::DB->resultset("Contact")->find({ + body => $bodies->{2636}, + category => 'Private', + }); + $child_cat->update({ + non_public => 1 + }); } FixMyStreet::DB::Factory::ResponseTemplate->create({ diff --git a/web/cobrands/isleofwight/js.js b/web/cobrands/isleofwight/js.js index 0665a99ba..d43006fd5 100644 --- a/web/cobrands/isleofwight/js.js +++ b/web/cobrands/isleofwight/js.js @@ -9,11 +9,14 @@ if (fixmystreet.cobrand == 'isleofwight') { // as the destination for reports in the "Public details" section. // This is OK because the cobranded site only shows categories which // Island Roads actually handle. - // Replacing this function with a no-op stops the changes made - // to the cobranded councils_text_all.html from being clobbered and - // the 'correct' (according to bodies set up within FMS) body names - // being shown. - fixmystreet.update_public_councils_text = function() {}; + // To achieve this we ignore the passed list of bodies and always + // use "Island Roads" when calling the original function. + // NB calling the original function is required so that private categories + // cause the correct text to be shown in the UI. + var original_update_public_councils_text = fixmystreet.update_public_councils_text; + fixmystreet.update_public_councils_text = function(text, bodies) { + original_update_public_councils_text.call(this, text, ['Island Roads']); + }; } var org_id = '1062'; |