From 5cff522976b840167b0ed7a1226c16b272238d06 Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Mon, 20 Jul 2020 11:11:55 +0100 Subject: [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. --- t/app/controller/contact_enquiry.t | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 't/app/controller/contact_enquiry.t') 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'); }; -- cgit v1.2.3 From 22cc2b0e1e6bb2dd7bde7231ad7f7190737ce545 Mon Sep 17 00:00:00 2001 From: M Somerville Date: Thu, 24 Sep 2020 14:39:59 +0100 Subject: Split up two username fields. Rename the not-logging-in username field to username_register. Keep the sign-in field as username because that e.g. overlaps with auth code in two-factor authentication. --- t/app/controller/contact_enquiry.t | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 't/app/controller/contact_enquiry.t') diff --git a/t/app/controller/contact_enquiry.t b/t/app/controller/contact_enquiry.t index feb2a0545..f1b5b15cd 100644 --- a/t/app/controller/contact_enquiry.t +++ b/t/app/controller/contact_enquiry.t @@ -80,7 +80,7 @@ FixMyStreet::override_config { $mech->submit_form_ok( { with_fields => { name => 'Test User', - username => 'testuser@example.org', + username_register => 'testuser@example.org', category => 'Other', detail => 'This is a general enquiry', } @@ -149,7 +149,7 @@ FixMyStreet::override_config { $mech->submit_form_ok( { with_fields => { name => 'Simon Neil', - username => $user->email, + username_register => $user->email, category => 'General Enquiry', detail => 'This is a general enquiry', } @@ -212,7 +212,7 @@ FixMyStreet::override_config { submit_problem => 1, token => $csrf, name => 'Test User', - username => 'testuser@example.org', + username_register => 'testuser@example.org', category => 'Other', detail => encode_utf8('This is a general enquiry‽'), photo1 => [ $sample_jpeg, undef, Content_Type => 'image/jpeg' ], -- cgit v1.2.3