diff options
author | Matthew Somerville <matthew@mysociety.org> | 2020-06-03 17:23:32 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2020-06-03 17:24:12 +0100 |
commit | e210a3576aa4fe247feafe4f7c0d27e308faba86 (patch) | |
tree | 4a6cc21ba47fe1ac736ddabba2fe6d94bb05d720 | |
parent | f2ef45fb4ed8e167a0dea3bba1a9cd1ad640a31c (diff) |
Store staff user when staff make anonymous update.
Match the identical code for anonymous reports.
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/Update.pm | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/Update.pm b/perllib/FixMyStreet/App/Controller/Report/Update.pm index c5d20a5da..8ffba3dcf 100644 --- a/perllib/FixMyStreet/App/Controller/Report/Update.pm +++ b/perllib/FixMyStreet/App/Controller/Report/Update.pm @@ -484,6 +484,13 @@ sub save_update : Private { $update->confirm(); } elsif ($c->stash->{contributing_as_anonymous_user}) { $update->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. + $update->set_extra_metadata( contributed_by => $c->user->id ); + } $update->confirm(); } elsif ( !$update->user->in_storage ) { # User does not exist. |