aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/_includes/admin-tasks-content.md30
-rw-r--r--perllib/FixMyStreet/Cobrand/Bexley.pm8
-rw-r--r--perllib/FixMyStreet/DB/Result/Comment.pm11
-rw-r--r--t/cobrand/bexley.t12
-rw-r--r--templates/web/base/report/_update_state.html2
5 files changed, 47 insertions, 16 deletions
diff --git a/docs/_includes/admin-tasks-content.md b/docs/_includes/admin-tasks-content.md
index 0fdc259e9..234565587 100644
--- a/docs/_includes/admin-tasks-content.md
+++ b/docs/_includes/admin-tasks-content.md
@@ -147,20 +147,22 @@ recognition of your staff role.
<div class="admin-task" markdown="1" id="create-reports-behalf-user">
-### Creating reports on behalf of another user/ the council
+### Creating reports/ updates on behalf of another user/ the council
<span class="admin-task__permissions">Permissions required: User must be marked
-as staff; one or more of ‘Create reports/updates on a user's behalf’, ‘Create
-reports/updates as anonymous user’ and ‘Create reports/updates as the council’
-must be ticked.</span>
-
-If a resident makes a report by phone or in person, staff members with the appropriate
-permissions can add it to FixMyStreet on their behalf. The report may bear the resident’s name; or
-it may be anonymous (i.e. the report-maker’s name is not published on the site, but will still be
-available in the admin interface). Alternatively, reports can be made as if from the council itself.
-In such cases, staff should make a new report just as a member of the public would — see ‘[The
+as staff; optionally, one or more of ‘Create reports/updates on a user's
+behalf’, ‘Create reports/updates as anonymous user’ and ‘Create reports/updates
+as the council’ can be ticked.</span>
+
+If a resident makes a report or update by phone or in person, staff members
+with the appropriate permissions can add it to FixMyStreet on their behalf. The
+report will be anonymous on the site, but the resident’s name will still be
+available in the admin interface. Reports can also be made as if from the
+council.
+
+Staff should make a new report just as a member of the public would — see ‘[The
citizen’s experience](/pro-manual/citizens-experience/)'. Those with the appropriate permissions will see a dropdown box in
-the report-making interface, labeled ‘Report As’. Select ‘the council’, ‘yourself’, ‘anonymous’ or
+the report-making interface, labeled ‘Report As’. Select either the council, ‘yourself’, ‘anonymous’ or
‘another user’.
If a user has the ‘Default to creating reports/update as the council’
@@ -168,6 +170,12 @@ permission then the dropdown will default to reporting as the council.
Staff with the ’Markup problem details’ permission will also default to
reporting as the council.
+When a staff member makes an update on the site, it will not be publicly
+displayed with the staff member’s name, but the name of the body to which the
+user is attached. Staff members with the ‘See user detail for reports created
+as the council’ permission will be able to see the staff user’s name on the
+report or update, but other staff and the public will not.
+
</div>
diff --git a/perllib/FixMyStreet/Cobrand/Bexley.pm b/perllib/FixMyStreet/Cobrand/Bexley.pm
index 215b9d2cb..2c05439be 100644
--- a/perllib/FixMyStreet/Cobrand/Bexley.pm
+++ b/perllib/FixMyStreet/Cobrand/Bexley.pm
@@ -221,4 +221,12 @@ sub _is_out_of_hours {
return 0;
}
+sub update_anonymous_message {
+ my ($self, $update) = @_;
+ my $t = Utils::prettify_dt( $update->confirmed );
+
+ my $staff = $update->user->from_body || $update->get_extra_metadata('is_body_user') || $update->get_extra_metadata('is_superuser');
+ return sprintf('Posted anonymously by a non-staff user at %s', $t) if !$staff;
+}
+
1;
diff --git a/perllib/FixMyStreet/DB/Result/Comment.pm b/perllib/FixMyStreet/DB/Result/Comment.pm
index a20c336a5..82476ba10 100644
--- a/perllib/FixMyStreet/DB/Result/Comment.pm
+++ b/perllib/FixMyStreet/DB/Result/Comment.pm
@@ -267,9 +267,14 @@ sub meta_line {
my $meta = '';
- if ($self->anonymous or !$self->name) {
- $meta = sprintf( _( 'Posted anonymously at %s' ), Utils::prettify_dt( $self->confirmed ) )
- } elsif ($self->user->from_body || $self->get_extra_metadata('is_body_user') || $self->get_extra_metadata('is_superuser') ) {
+ my $contributed_as = $self->get_extra_metadata('contributed_as') || '';
+ my $staff = $self->user->from_body || $self->get_extra_metadata('is_body_user') || $self->get_extra_metadata('is_superuser');
+ my $anon = $self->anonymous || !$self->name;
+
+ if ($anon && (!$staff || $contributed_as eq 'anonymous_user' || $contributed_as eq 'another_user')) {
+ $meta = $cobrand->call_hook(update_anonymous_message => $self);
+ $meta ||= sprintf( _( 'Posted anonymously at %s' ), Utils::prettify_dt( $self->confirmed ) )
+ } elsif ($staff) {
my $user_name = FixMyStreet::Template::html_filter($self->user->name);
my $body;
if ($self->get_extra_metadata('is_superuser')) {
diff --git a/t/cobrand/bexley.t b/t/cobrand/bexley.t
index 8ce6c45f2..46a25d923 100644
--- a/t/cobrand/bexley.t
+++ b/t/cobrand/bexley.t
@@ -147,7 +147,7 @@ FixMyStreet::override_config {
subtest 'resend is disabled in admin' => sub {
my $user = $mech->log_in_ok('super@example.org');
- $user->update({ from_body => $body, is_superuser => 1 });
+ $user->update({ from_body => $body, is_superuser => 1, name => 'Staff User' });
$mech->get_ok('/admin/report_edit/' . $report->id);
$mech->content_contains('View report on site');
$mech->content_lacks('Resend report');
@@ -202,6 +202,16 @@ FixMyStreet::override_config {
], 'Request had multiple photos';
};
+ subtest 'anonymous update message' => sub {
+ my $report = FixMyStreet::DB->resultset("Problem")->first;
+ my $staffuser = $mech->create_user_ok('super@example.org');
+ $mech->create_comment_for_problem($report, $report->user, 'Commenter', 'Normal update', 't', 'confirmed', 'confirmed');
+ $mech->create_comment_for_problem($report, $staffuser, 'Staff user', 'Staff update', 'f', 'confirmed', 'confirmed');
+ $mech->get_ok('/report/' . $report->id);
+ $mech->content_contains('Posted by <strong>London Borough of Bexley</strong>');
+ $mech->content_contains('Posted anonymously by a non-staff user');
+ };
+
};
subtest 'nearest road returns correct road' => sub {
diff --git a/templates/web/base/report/_update_state.html b/templates/web/base/report/_update_state.html
index ecac68850..d484dcb05 100644
--- a/templates/web/base/report/_update_state.html
+++ b/templates/web/base/report/_update_state.html
@@ -12,7 +12,7 @@
<p class="meta-2">
[% INCLUDE meta_line %]
- [% IF c.user_exists AND c.user.id == update.user_id AND !update.anonymous %]
+ [% IF c.user_exists AND c.user.id == update.user_id AND !update.anonymous AND NOT (c.user.from_body OR c.user.is_superuser) %]
<small>(<a href="/my/anonymize?update=[% update.id | uri %]" class="js-hide-name">[% loc('Hide your name?') %]</a>)</small>
[% END %]
[% mlog = update.latest_moderation_log_entry(); IF mlog %]