diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Reports.pm | 13 | ||||
-rw-r--r-- | templates/web/base/report/_item.html | 2 |
2 files changed, 12 insertions, 3 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}) { diff --git a/templates/web/base/report/_item.html b/templates/web/base/report/_item.html index a892086ca..153fbf58e 100644 --- a/templates/web/base/report/_item.html +++ b/templates/web/base/report/_item.html @@ -43,7 +43,7 @@ <span class="item-list__item__state">[% loc('Fixed') %]</span> [% ELSIF NOT no_fixed AND problem.is_closed %] <span class="item-list__item__state">[% loc('Closed') %]</span> - [% ELSIF problem.response_priority AND (c.user.has_permission_to('report_edit_priority', problem.bodies_str_ids) OR c.user.has_permission_to('report_inspect', problem.bodies_str_ids)) %] + [% ELSIF (c.user.has_permission_to('report_edit_priority', problem.bodies_str_ids) OR c.user.has_permission_to('report_inspect', problem.bodies_str_ids)) AND problem.response_priority %] <span class="item-list__item__state">[% problem.response_priority.name %]</span> [% END %] [%- IF c.cobrand.moniker != 'fixamingata' %] [%# Default: %] |