diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Moderate.pm | 5 | ||||
-rw-r--r-- | templates/web/base/report/_main.html | 14 | ||||
-rw-r--r-- | templates/web/base/report/display.html | 3 | ||||
-rw-r--r-- | templates/web/base/report/update.html | 8 |
4 files changed, 10 insertions, 20 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Moderate.pm b/perllib/FixMyStreet/App/Controller/Moderate.pm index 42dc759e5..4d3a97fa8 100644 --- a/perllib/FixMyStreet/App/Controller/Moderate.pm +++ b/perllib/FixMyStreet/App/Controller/Moderate.pm @@ -21,10 +21,7 @@ data to change. (Authentication requires: - user to be from_body - - user to have a "moderate" record in user_body_permissions (there is - currently no admin interface for this. Should be added, but - while we're trialing this, it's a simple case of adding a DB record - manually) + - user to have a "moderate" record in user_body_permissions The original data of the report is stored in moderation_original_data, so that it can be reverted/consulted if required. All moderation events are diff --git a/templates/web/base/report/_main.html b/templates/web/base/report/_main.html index 405cb2118..25bbd4c33 100644 --- a/templates/web/base/report/_main.html +++ b/templates/web/base/report/_main.html @@ -1,13 +1,9 @@ -[% IF c.user_exists %] - [% DEFAULT permissions = c.user.permissions(c, problem.bodies_str) %] -[%- END %] - <a href="[% c.uri_for( '/around', { lat => latitude, lon => longitude } ) %]" class="problem-back js-back-to-report-list">[% loc('Back to all reports') %]</a> <div class="problem-header clearfix" data-lastupdate="[% problem.lastupdate %]"> -[% IF c.user.has_permission_to('planned_reports', problem.bodies_str_ids) %] +[% IF permissions.planned_reports %] <form method="post" action="/my/planned/change" id="planned_form" class="hidden-label-target"> <input type="hidden" name="id" value="[% problem.id %]"> <input type="hidden" name="token" value="[% csrf_token %]"> @@ -124,16 +120,12 @@ </form> [% END %] - [% IF - (permissions.moderate) - OR - (c.user.has_permission_to('planned_reports', problem.bodies_str_ids)) - %] + [% IF permissions.moderate OR permissions.planned_reports %] <div class="moderate-display segmented-control" role="menu"> [% IF permissions.moderate %] <a class="js-moderate btn" role="menuitem" aria-label="[% loc('Moderate this report') %]">[% loc('Moderate') %]</a> [% END %] - [% IF c.user.has_permission_to('planned_reports', problem.bodies_str_ids) %] + [% IF permissions.planned_reports %] [%~ IF c.user.is_planned_report(problem) ~%] <label class="btn btn--shortlisted" for="shortlist-report" role="menuitem" aria-label="[% loc('Remove from shortlist') %]">[% loc('Shortlisted') %]</label> [%~ ELSE ~%] diff --git a/templates/web/base/report/display.html b/templates/web/base/report/display.html index 7c26c4938..d5e3bdcfa 100644 --- a/templates/web/base/report/display.html +++ b/templates/web/base/report/display.html @@ -39,6 +39,9 @@ [% END %] [% INCLUDE 'report/banner.html' %] +[% IF c.user_exists %] + [% DEFAULT permissions = c.user.permissions(c, problem.bodies_str) %] +[%- END %] [% INCLUDE 'report/_main.html' %] [% IF problem.duplicate_of %] diff --git a/templates/web/base/report/update.html b/templates/web/base/report/update.html index 5691376e6..6dca226fe 100644 --- a/templates/web/base/report/update.html +++ b/templates/web/base/report/update.html @@ -1,12 +1,10 @@ -[% moderating = c.user && c.user.has_permission_to('moderate', problem.bodies_str_ids) %] - [% IF loop.first %] <section class="full-width"> <h4 class="static-with-rule">[% loc('Updates') %]</h4> <ul class="item-list item-list--updates"> [% END %] <li class="item-list__item item-list__item--updates"> - [% IF moderating; original_update = update.moderation_original_data %] + [% IF permissions.moderate; original_update = update.moderation_original_data %] <form method="post" action="/moderate/report/[% problem.id %]/update/[% update.id %]"> <input type="hidden" name="token" value="[% csrf_token %]"> <input type="button" class="btn js-moderate moderate-display" value="[% loc('Moderate this update') %]"> @@ -33,7 +31,7 @@ <div class="moderate-display"> [% update.text | add_links | markup(update.user) | html_para %] </div> - [% IF moderating %] + [% IF permissions.moderate %] <div class="moderate-edit"> [% IF update.text != original.detail %] <label><input type="checkbox" name="update_revert_detail" class="revert-textarea"> @@ -66,7 +64,7 @@ </div> [% END %] </div> - [% IF moderating %] + [% IF permissions.moderate %] <div class="moderate-edit"> <label for="moderation_reason">[% loc('Moderation reason:') %]</label> <input type="text" class="form-control" name="moderation_reason" |