aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--t/app/controller/report_inspect.t13
-rw-r--r--templates/web/base/navigation/_all_reports.html2
2 files changed, 14 insertions, 1 deletions
diff --git a/t/app/controller/report_inspect.t b/t/app/controller/report_inspect.t
index aeb344922..8deb2667e 100644
--- a/t/app/controller/report_inspect.t
+++ b/t/app/controller/report_inspect.t
@@ -119,12 +119,23 @@ FixMyStreet::override_config {
good_link => "/reports",
bad_link => "/my/inspector_redirect",
},
+ {
+ name => "categories but no from_body",
+ area_ids => undef,
+ categories => [ $contact->id ],
+ destination => "/my",
+ query_form => {},
+ good_link => "/reports",
+ bad_link => "/my/inspector_redirect",
+ unset_from_body => 1,
+ },
) {
subtest "login destination and top-level nav for inspectors with " . $test->{name} => sub {
$mech->log_out_ok;
$user->area_ids($test->{area_ids});
$user->set_extra_metadata('categories', $test->{categories});
+ $user->from_body(undef) if $test->{unset_from_body};
$user->update;
# Can't use log_in_ok, as the call to logged_in_ok clobbers our post-login
@@ -144,6 +155,8 @@ FixMyStreet::override_config {
$mech->get_ok("/");
ok $mech->find_link( text => 'All reports', url => $test->{good_link} );
ok !$mech->find_link( text => 'All reports', url => $test->{bad_link} );
+
+ $user->update( { from_body => $oxon } ) if $test->{unset_from_body};
};
}
diff --git a/templates/web/base/navigation/_all_reports.html b/templates/web/base/navigation/_all_reports.html
index bcc40ed5d..3f2aa6bbc 100644
--- a/templates/web/base/navigation/_all_reports.html
+++ b/templates/web/base/navigation/_all_reports.html
@@ -1,5 +1,5 @@
[%~
- IF c.user_exists AND ( c.user.categories.size OR c.user.area_ids.size );
+ IF c.user_exists AND c.user.from_body AND ( c.user.categories.size OR c.user.area_ids.size );
reports_uri = '/my/inspector_redirect';
ELSE;
reports_uri = '/reports';