Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

check for email in abuse later in case we change the user

  • Loading branch information...
commit cb6652c402118114840d0c73c5b2d4b5658ed239 1 parent 01626e8
@struan struan authored
View
5 perllib/FixMyStreet/App/Controller/Admin.pm
@@ -589,7 +589,6 @@ sub report_edit : Path('report_edit') : Args(1) {
$c->forward('get_token');
$c->forward('check_page_allowed');
- $c->forward('check_email_for_abuse', [ $problem->user->email ] );
$c->stash->{updates} =
[ $c->model('DB::Comment')
@@ -702,6 +701,10 @@ sub report_edit : Path('report_edit') : Args(1) {
}
}
+ # we check this here in case the user was changed by the editing
+ # process
+ $c->forward('check_email_for_abuse', [ $problem->user->email ] );
+
return 1;
}
View
24 t/app/controller/admin.t
@@ -611,6 +611,30 @@ subtest 'adding email to abuse list from report page' => sub {
$mech->content_contains('<small>(Email in abuse table)</small>');
};
+subtest 'Changing user from banned one removed banned text' => sub {
+ my $email = $report->user->email;
+
+ my $abuse = FixMyStreet::App->model('DB::Abuse')->find_or_create( { email => $email } );
+ $abuse->insert unless $abuse->in_storage;
+
+ $mech->get_ok( '/admin/report_edit/' . $report->id );
+ $mech->content_contains('Email in abuse table');
+
+ my $fields = $mech->visible_form_values;
+ $fields->{ email } = 'unbanned@example.com';
+
+ $mech->submit_form_ok(
+ {
+ with_fields => $fields,
+ }
+ );
+
+ $mech->content_lacks('<small>(Email in abuse table)</small>');
+
+ $report->discard_changes;
+ is $report->user->email, 'unbanned@example.com';
+};
+
subtest 'flagging user from report page' => sub {
$report->user->flagged(0);
$report->user->update;
Please sign in to comment.
Something went wrong with that request. Please try again.