aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/Problem.pm6
-rw-r--r--t/app/model/problem.t29
2 files changed, 34 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/DB/ResultSet/Problem.pm b/perllib/FixMyStreet/DB/ResultSet/Problem.pm
index 97d457297..b00daab40 100644
--- a/perllib/FixMyStreet/DB/ResultSet/Problem.pm
+++ b/perllib/FixMyStreet/DB/ResultSet/Problem.pm
@@ -259,10 +259,14 @@ sub send_reports {
}
$cobrand->set_lang_and_domain($row->lang, 1);
- if ( $row->is_from_abuser ) {
+ if ( $row->is_from_abuser) {
$row->update( { state => 'hidden' } );
debug_print("hiding because its sender is flagged as an abuser", $row->id) if $debug_mode;
next;
+ } elsif ( $row->title =~ /app store test/i ) {
+ $row->update( { state => 'hidden' } );
+ debug_print("hiding because it is an app store test message", $row->id) if $debug_mode;
+ next;
}
# Template variables for the email
diff --git a/t/app/model/problem.t b/t/app/model/problem.t
index 5d02aef2b..c9fa1a6e3 100644
--- a/t/app/model/problem.t
+++ b/t/app/model/problem.t
@@ -630,6 +630,35 @@ subtest 'check can turn on report sent email alerts' => sub {
like $email->body, qr/Your report about/, 'report sent body correct';
};
+
+subtest 'check iOS app store test reports not sent' => sub {
+ $mech->clear_emails_ok;
+
+ FixMyStreet::App->model('DB::Problem')->search(
+ {
+ whensent => undef
+ }
+ )->update( { whensent => \'ms_current_timestamp()' } );
+
+ $problem->discard_changes;
+ $problem->update( {
+ title => 'App store test',
+ state => 'confirmed',
+ confirmed => \'ms_current_timestamp()',
+ whensent => undef,
+ category => 'potholes',
+ send_fail_count => 0,
+ } );
+
+ FixMyStreet::App->model('DB::Problem')->send_reports();
+
+ $mech->email_count_is( 0 );
+
+ $problem->discard_changes();
+ is $problem->state, 'hidden', 'iOS test reports are hidden automatically';
+ is $problem->whensent, undef, 'iOS test reports are not sent';
+};
+
subtest 'check reports from abuser not sent' => sub {
$mech->clear_emails_ok;