diff options
author | Dave Arter <davea@mysociety.org> | 2019-12-13 10:39:50 +0000 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2019-12-17 10:59:55 +0000 |
commit | ea56a97b90235ff5702840ff7b2d8f209bedfc13 (patch) | |
tree | fa5d8f07189c8a187640423cb85691ab55591257 /perllib/FixMyStreet/App/Controller/Report/New.pm | |
parent | 874e26c3b564424c8dcf677886cf1d54ab2ea70b (diff) |
Store staff user when staff make anonymous report.
If a staff user uses the anonymous button, it does not otherwise record
which staff user did that; using Report As would store their user as the
report's user.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Report/New.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index 974777ee7..db469f130 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -1443,6 +1443,13 @@ sub save_user_and_report : Private { $report->confirm(); } elsif ($c->stash->{contributing_as_anonymous_user}) { $report->set_extra_metadata( contributed_as => 'anonymous_user' ); + if ( $c->user_exists && $c->user->from_body ) { + # If a staff user has clicked the 'report anonymously' button then + # there would be no record of who that staff member was as we've + # used the cobrand's anonymous_account for the report. In this case + # record the staff user ID in the report metadata. + $report->set_extra_metadata( contributed_by => $c->user->id ); + } $report->confirm(); } elsif ( !$report->user->in_storage ) { # User does not exist. |