aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/Script/Alerts.pm1
-rw-r--r--t/app/controller/alert_new.t11
2 files changed, 3 insertions, 9 deletions
diff --git a/perllib/FixMyStreet/Script/Alerts.pm b/perllib/FixMyStreet/Script/Alerts.pm
index 86f11c7b5..aefdf82d5 100644
--- a/perllib/FixMyStreet/Script/Alerts.pm
+++ b/perllib/FixMyStreet/Script/Alerts.pm
@@ -103,6 +103,7 @@ sub send() {
my $url = $cobrand->base_url_for_report($row);
# this is currently only for new_updates
if (defined($row->{item_text})) {
+ next unless $row->{item_text};
if ( $cobrand->moniker ne 'zurich' && $row->{alert_user_id} == $row->{user_id} ) {
# This is an alert to the same user who made the report - make this a login link
# Don't bother with Zurich which has no accounts
diff --git a/t/app/controller/alert_new.t b/t/app/controller/alert_new.t
index 97a19b3b8..33b3ae92b 100644
--- a/t/app/controller/alert_new.t
+++ b/t/app/controller/alert_new.t
@@ -475,7 +475,7 @@ subtest "Test normal alert signups and that alerts are sent" => sub {
$mech->delete_user($user2);
};
-subtest "Test alerts are correct for no-text updates" => sub {
+subtest "Test alerts are not sent for no-text updates" => sub {
$mech->delete_user( 'reporter@example.com' );
$mech->delete_user( 'alerts@example.com' );
@@ -540,14 +540,7 @@ subtest "Test alerts are correct for no-text updates" => sub {
FixMyStreet::Script::Alerts::send();
};
- $mech->email_count_is(1);
- my $email = $mech->get_email;
- my $body = $mech->get_text_body_from_email($email);
- like $body, qr/The following updates have been left on this report:/, 'email is about updates to existing report';
- like $body, qr/Staff User/, 'Update comes from correct user';
-
- my @urls = $mech->get_link_from_email($email, 1);
- is $urls[0], "http://www.example.org/report/" . $report_id, "Correct report URL in email";
+ $mech->email_count_is(0);
$mech->delete_user($user1);
$mech->delete_user($user2);