aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Admin.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2018-05-11 15:40:56 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2018-05-23 18:55:09 +0100
commit110a80eff22e852974bc5a6f90295803ef7e0de6 (patch)
tree01372412d0d65fb2c0dec99c56ba7867d480af80 /perllib/FixMyStreet/App/Controller/Admin.pm
parenta3c182e75b022b3002eb4801fd446c891391b675 (diff)
Factor anonymize function to User model.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Admin.pm')
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm15
1 files changed, 1 insertions, 14 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index 8f8d7cc47..0d897e71e 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -1911,20 +1911,7 @@ sub user_hide_everywhere : Private {
sub user_remove_account : Private {
my ( $self, $c, $user ) = @_;
$c->forward('user_logout_everywhere', [ $user ]);
- $user->problems->update({ anonymous => 1, name => '', send_questionnaire => 0 });
- $user->comments->update({ anonymous => 1, name => '' });
- $user->alerts->update({ whendisabled => \'current_timestamp' });
- $user->password('', 1);
- $user->update({
- email => 'removed-' . $user->id . '@' . FixMyStreet->config('EMAIL_DOMAIN'),
- email_verified => 0,
- name => '',
- phone => '',
- phone_verified => 0,
- title => undef,
- twitter_id => undef,
- facebook_id => undef,
- });
+ $user->anonymize_account;
$c->stash->{status_message} = _('That user’s personal details have been removed.');
}