diff options
author | Dave Arter <davea@mysociety.org> | 2019-05-02 16:53:45 +0100 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2019-06-04 14:54:27 +0100 |
commit | f4b69185b8f9402ce71bec2fba527145af05af0e (patch) | |
tree | 982143c367e32aae3e8e423a09e9f35daefd4be5 | |
parent | 84d49bae300280f6169b9543657f8cfa8861643b (diff) |
Don’t include non_public reports when searching by ref from front page
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Around.pm | 2 | ||||
-rw-r--r-- | t/app/controller/around.t | 10 |
3 files changed, 12 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 79c50ecfb..ea2d6cd56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Bugfixes: - Prevent creation of two templates with same title. - Fix bug going between report/new pages client side + - Don't include private reports when searching by ref from front page. - Development improvements: - Upgrade the underlying framework and a number of other packages. - Add feature cobrand helper function. diff --git a/perllib/FixMyStreet/App/Controller/Around.pm b/perllib/FixMyStreet/App/Controller/Around.pm index a09161494..203296c4d 100644 --- a/perllib/FixMyStreet/App/Controller/Around.pm +++ b/perllib/FixMyStreet/App/Controller/Around.pm @@ -416,7 +416,7 @@ sub lookup_by_ref : Private { external_id => $ref ]; - my $problems = $c->cobrand->problems->search( $criteria ); + my $problems = $c->cobrand->problems->search({ non_public => 0, -or => $criteria }); my $count = try { $problems->count; diff --git a/t/app/controller/around.t b/t/app/controller/around.t index 5ef37f197..829d78ca3 100644 --- a/t/app/controller/around.t +++ b/t/app/controller/around.t @@ -100,6 +100,16 @@ subtest 'check lookup by reference' => sub { is $mech->uri->path, "/report/$id", "redirected to report page"; }; +subtest 'check lookup by reference does not show non_public reports' => sub { + $edinburgh_problems[0]->update({ + non_public => 1 + }); + my $id = $edinburgh_problems[0]->id; + $mech->get_ok('/'); + $mech->submit_form_ok( { with_fields => { pc => "ref:$id" } }, 'non_public ref'); + $mech->content_contains('Searching found no reports'); +}; + subtest 'check non public reports are not displayed on around page' => sub { $mech->get_ok('/'); FixMyStreet::override_config { |