aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/App/Controller/Contact.pm4
-rw-r--r--t/app/controller/contact.t9
2 files changed, 13 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Contact.pm b/perllib/FixMyStreet/App/Controller/Contact.pm
index 9d7051e2f..f28d37989 100644
--- a/perllib/FixMyStreet/App/Controller/Contact.pm
+++ b/perllib/FixMyStreet/App/Controller/Contact.pm
@@ -164,6 +164,10 @@ sub prepare_params_for_email : Private {
$c->stash->{problem}->id,
$problem_url, $admin_url
);
+
+ # flag this so it's automatically listed in the admin interface
+ $c->stash->{problem}->flagged(1);
+ $c->stash->{problem}->update;
}
return 1;
diff --git a/t/app/controller/contact.t b/t/app/controller/contact.t
index bbb3a0f83..a69a56ac4 100644
--- a/t/app/controller/contact.t
+++ b/t/app/controller/contact.t
@@ -248,6 +248,9 @@ for my $test (
)
{
subtest 'check email sent correctly' => sub {
+ $problem_main->discard_changes;
+ ok !$problem_main->flagged, 'problem not flagged';
+
$mech->clear_emails_ok;
if ($test->{fields}{id}) {
$mech->get_ok('/contact?id=' . $test->{fields}{id});
@@ -267,6 +270,12 @@ for my $test (
my $problem_id = $test->{fields}{id};
like $email->body, qr/Complaint about report $problem_id/, 'reporting a report'
if $test->{fields}{id};
+
+ if ( $problem_id ) {
+ $problem_main->discard_changes;
+ ok $problem_main->flagged, 'problem flagged';
+ }
+
};
}