diff options
author | Dave Arter <davea@mysociety.org> | 2019-06-24 17:28:41 +0100 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2019-07-09 20:13:18 +0100 |
commit | 0ea7e84beeea32c51b3592fcacd5824552dba15d (patch) | |
tree | 93e03c14a92a7c641ab88c014dff8c1eed16d006 | |
parent | 4e48429cb18b760ee840bd3b28eeb5b1592a05ff (diff) |
Indicate in report new AJAX if a category is private
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 2 | ||||
-rw-r--r-- | t/app/controller/report_new.t | 15 |
2 files changed, 17 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index 7c7ebd202..00cd91d03 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -274,8 +274,10 @@ sub by_category_ajax_data : Private { $category ? (list_of_names => $list_of_names) : (), }; + my $non_public = $c->stash->{non_public_categories}->{$category}; my $body = { bodies => $list_of_names, + $non_public ? (non_public => JSON->true) : (), }; if ($generate) { diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t index f65ca243d..e824eb143 100644 --- a/t/app/controller/report_new.t +++ b/t/app/controller/report_new.t @@ -152,6 +152,12 @@ my $contact17 = $mech->create_contact_ok( category => 'Trees', email => 'trees-2483@example.com', ); +my $contact18 = $mech->create_contact_ok( + body_id => $body_ids{2483}, # Hounslow + category => 'General Enquiry', + email => 'general-enquiry-2483@example.com', + non_public => 1, +); # test that the various bit of form get filled in and errors correctly # generated. @@ -1418,6 +1424,15 @@ subtest "check map click ajax response" => sub { $extra_details = $mech->get_ok_json( '/report/new/ajax?latitude=51.482286&longitude=-0.328163' ); }; isnt defined $extra_details->{display_names}, 'no council display names if none defined'; + + FixMyStreet::override_config { + ALLOWED_COBRANDS => 'hounslow', + MAPIT_URL => 'http://mapit.uk/', + }, sub { + $extra_details = $mech->get_ok_json( '/report/new/ajax?latitude=51.482286&longitude=-0.328163' ); + }; + ok $extra_details->{by_category}->{'General Enquiry'}->{non_public}, 'non_public set correctly for private category'; + isnt defined $extra_details->{by_category}->{Tree}->{non_public}, 'non_public omitted for public category'; }; #### test uploading an image |