aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Script/Alerts.pm
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2017-08-22 17:29:35 +0100
committerDave Arter <davea@mysociety.org>2017-08-22 17:29:35 +0100
commit22dd06a50f24df15f782e0e4a327b0d0685e793d (patch)
treed886254b28ea8953727731e5d505318fa487efb1 /perllib/FixMyStreet/Script/Alerts.pm
parentf0f863865a270d9a508e8c3c273a31764555e60f (diff)
Fix missing URLs in alert emails
If a staff user changed a problem’s state and an empty update was generated, it was possible for alert emails to be sent with missing URLs because the empty string in the update text was falsy and Alert.pm took the wrong path. This fixes the problem by changing the test to defined() and includes a regression test.
Diffstat (limited to 'perllib/FixMyStreet/Script/Alerts.pm')
-rw-r--r--perllib/FixMyStreet/Script/Alerts.pm2
1 files changed, 1 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/Script/Alerts.pm b/perllib/FixMyStreet/Script/Alerts.pm
index aefe13318..c001cc311 100644
--- a/perllib/FixMyStreet/Script/Alerts.pm
+++ b/perllib/FixMyStreet/Script/Alerts.pm
@@ -102,7 +102,7 @@ sub send() {
my $url = $cobrand->base_url_for_report($row);
# this is currently only for new_updates
- if ($row->{item_text}) {
+ if (defined($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