aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Admin.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Admin.pm')
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm34
1 files changed, 34 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index f0a7e94b6..ed7fc7ce8 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -518,6 +518,9 @@ sub report_edit : Path('report_edit') : Args(1) {
$c->forward( 'log_edit', [ $id, 'problem', 'resend' ] );
}
+ elsif ( $c->req->param('flaguser') ) {
+ $c->forward('flag_user');
+ }
elsif ( $c->req->param('banuser') ) {
$c->forward('ban_user');
}
@@ -632,6 +635,9 @@ sub update_edit : Path('update_edit') : Args(1) {
if ( $c->req->param('banuser') ) {
$c->forward('ban_user');
}
+ elsif ( $c->req->param('flaguser') ) {
+ $c->forward('flag_user');
+ }
elsif ( $c->req->param('submit') ) {
$c->forward('check_token');
@@ -863,6 +869,34 @@ sub ban_user : Private {
return 1;
}
+=head2 flag_user
+
+Sets the flag on a user with the give email
+
+=cut
+
+sub flag_user : Private {
+ my ( $self, $c ) = @_;
+
+ my $email = $c->req->param('email');
+
+ return unless $email;
+
+ my $user = $c->model('DB::User')->find({ email => $email });
+
+ if ( !$user ) {
+ $c->stash->{status_message} = _('Could not find user');
+ } else {
+ $user->flagged(1);
+ $user->update;
+ $c->stash->{status_message} = _('User flagged');
+ }
+
+ $c->stash->{user_flagged} = 1;
+
+ return 1;
+}
+
=head2 check_email_for_abuse