aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2017-08-18 21:12:48 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2017-08-23 14:01:31 +0100
commitd217e9be67c0f552924773858ede5ee3f7fc88e4 (patch)
tree4b742dc3f498e520a39937a0ac26eca01f9db4be /perllib
parent2b4ed83466ddf54f6d7e77088dc7e755f9259e91 (diff)
Join response_priority if needed, and reorder template conditional to not check if no permission.
Diffstat (limited to 'perllib')
-rw-r--r--perllib/FixMyStreet/App/Controller/Reports.pm13
1 files changed, 11 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm
index 20ec8f0a2..b597cb7a8 100644
--- a/perllib/FixMyStreet/App/Controller/Reports.pm
+++ b/perllib/FixMyStreet/App/Controller/Reports.pm
@@ -414,8 +414,17 @@ sub load_and_group_problems : Private {
order_by => $c->stash->{sort_order},
rows => $c->cobrand->reports_per_page,
};
- if ($c->user_exists && $c->stash->{body} && $c->user->has_permission_to('planned_reports', $c->stash->{body}->id)) {
- $filter->{prefetch} = 'user_planned_reports';
+ if ($c->user_exists && $c->stash->{body}) {
+ my $bid = $c->stash->{body}->id;
+ my $prefetch = [];
+ if ($c->user->has_permission_to('planned_reports', $bid)) {
+ push @$prefetch, 'user_planned_reports';
+ }
+ if ($c->user->has_permission_to('report_edit_priority', $bid) || $c->user->has_permission_to('report_inspect', $bid)) {
+ push @$prefetch, 'response_priority';
+ }
+ $prefetch = $prefetch->[0] if @$prefetch == 1;
+ $filter->{prefetch} = $prefetch;
}
if (defined $c->stash->{filter_status}{shortlisted}) {