aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm2
-rw-r--r--t/app/controller/report_new.t15
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