diff options
author | Struan Donald <struan@exo.org.uk> | 2020-07-20 11:11:55 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2020-07-20 14:03:03 +0100 |
commit | 5cff522976b840167b0ed7a1226c16b272238d06 (patch) | |
tree | 42455d5440e22c7e3e7fb2f9f05edab5415f0cbc | |
parent | d1dc00d5f911809f2e1e5a2b8ff383164914e94d (diff) |
[Hounslow] skip disabled contacts in enquiry form
This is largely to resolve an issue with the TfL other category
appearing in the contact form even though it is disabled, and hence has
no contact details.
-rw-r--r-- | t/app/controller/contact_enquiry.t | 10 | ||||
-rw-r--r-- | templates/web/base/contact/enquiry/index.html | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/t/app/controller/contact_enquiry.t b/t/app/controller/contact_enquiry.t index af249ec6c..feb2a0545 100644 --- a/t/app/controller/contact_enquiry.t +++ b/t/app/controller/contact_enquiry.t @@ -40,9 +40,18 @@ my $contact4 = $mech->create_contact_ok( category => 'Carriageway Defect', email => 'potholes@example.com', ); +my $contact5 = $mech->create_contact_ok( + body_id => $body->id, + category => 'Other (disabled)', + email => 'other@example.com', +); $contact->update( { extra => { group => 'General Enquiries' } } ); $contact2->update( { extra => { group => 'General Enquiries' } } ); $contact3->update( { extra => { group => 'Other' } } ); +$contact5->update( { extra => { group => 'Other' } } ); + +$contact5->push_extra_fields({ code => '_fms_disable_', 'disable_form' => 'true', description => 'form_disabled' }); +$contact5->update; FixMyStreet::override_config { ALLOWED_COBRANDS => ['bromley'], }, sub { subtest 'redirected to / if general enquiries not enabled' => sub { @@ -60,6 +69,7 @@ FixMyStreet::override_config { subtest 'Non-general enquiries category not shown' => sub { $mech->get_ok( '/contact/enquiry' ); $mech->content_lacks('Carriageway Defect'); + $mech->content_lacks('Other (disabled)'); $mech->content_contains('FOI Request'); }; diff --git a/templates/web/base/contact/enquiry/index.html b/templates/web/base/contact/enquiry/index.html index c88ca221e..1180c08b4 100644 --- a/templates/web/base/contact/enquiry/index.html +++ b/templates/web/base/contact/enquiry/index.html @@ -34,6 +34,7 @@ <select class="form-control required" name="category" id="category"> <option value="">[% loc('-- Please select --') %]</option> [% FOREACH contact IN contacts %] + [% NEXT IF contact.get_extra_field(, 'code', '_fms_disable_').disable_form == 'true' %] <option value="[% contact.category | html %]" [% "selected" IF report.category == contact.category %]>[% contact.category | html %]</option> [% END %] </select> |