diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-08-04 21:15:58 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-08-05 08:00:42 +0100 |
commit | e8230e1df6fbb3d5db77dc16d5783742f17df3e8 (patch) | |
tree | 96d155d67c195276e886fdc962800bdda074cf09 | |
parent | c15d06408eed6a29bce5b10a4cd8599b5b6aa37e (diff) |
Don't put filter_category in URL if no categories.
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report.pm | 2 | ||||
-rw-r--r-- | t/app/controller/report_inspect.t | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index 72cb0814c..b31877839 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -452,10 +452,10 @@ sub inspect : Private { if ($c->user->has_body_permission_to('planned_reports')) { my $categories = join(',', @{ $c->user->categories }); my $params = { - filter_category => $categories, lat => $problem->latitude, lon => $problem->longitude, }; + $params->{filter_category} = $categories if $categories; $redirect_uri = $c->uri_for( "/around", $params ); } diff --git a/t/app/controller/report_inspect.t b/t/app/controller/report_inspect.t index 1a3cc0fbc..447e28028 100644 --- a/t/app/controller/report_inspect.t +++ b/t/app/controller/report_inspect.t @@ -30,6 +30,7 @@ my $report3_id = $report3->id; my $user = $mech->log_in_ok('test@example.com'); +$user->set_extra_metadata('categories', [ $contact->id ]); $user->update( { from_body => $oxon } ); FixMyStreet::override_config { @@ -69,6 +70,7 @@ FixMyStreet::override_config { subtest "test inspect & instruct submission" => sub { $user->user_body_permissions->create({ body => $oxon, permission_type => 'report_instruct' }); + $user->user_body_permissions->create({ body => $oxon, permission_type => 'planned_reports' }); $report->state('confirmed'); $report->update; my $reputation = $report->user->get_extra_metadata("reputation"); @@ -81,6 +83,8 @@ FixMyStreet::override_config { is $report->comments->first->text, "This is a public update.", 'Update was created'; is $report->get_extra_metadata('inspected'), 1, 'report marked as inspected'; is $report->user->get_extra_metadata('reputation'), $reputation, "User reputation wasn't changed"; + $user->unset_extra_metadata('categories'); + $user->update; }; subtest "test update is required when instructing" => sub { @@ -100,8 +104,9 @@ FixMyStreet::override_config { $mech->get_ok("/report/$report_id"); $mech->submit_form_ok({ button => 'save', with_fields => { latitude => 55, longitude => -2 } }); $mech->content_contains('Invalid location'); - $mech->submit_form_ok({ button => 'save', with_fields => { latitude => 51.754926, longitude => -1.256179 } }); + $mech->submit_form_ok({ button => 'save', with_fields => { latitude => 51.754926, longitude => -1.256179, include_update => undef } }); $mech->content_lacks('Invalid location'); + $user->user_body_permissions->search({ body_id => $oxon->id, permission_type => 'planned_reports' })->delete; }; subtest "test duplicate reports are shown" => sub { |