aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2012-09-04 14:06:13 +0100
committerStruan Donald <struan@exo.org.uk>2012-09-04 14:06:13 +0100
commitcee57ea08a3be30b72aed14d4f20f355dd5e2922 (patch)
tree23e5ad89b8e1cba5f42444481f00f0256b45f5fc /perllib
parent982357e692dc8e031bba765f333784c10dd6ec1e (diff)
do no send alerts for non public reports
Diffstat (limited to 'perllib')
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/AlertType.pm4
1 files changed, 4 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/DB/ResultSet/AlertType.pm b/perllib/FixMyStreet/DB/ResultSet/AlertType.pm
index a0320ccc3..2d206d84e 100644
--- a/perllib/FixMyStreet/DB/ResultSet/AlertType.pm
+++ b/perllib/FixMyStreet/DB/ResultSet/AlertType.pm
@@ -65,6 +65,9 @@ sub email_alerts ($) {
# call checks if this is the host that sends mail for this cobrand.
next unless $cobrand->email_host;
+ # this is for the new_updates alerts
+ next if $row->{non_public} and $row->{user_id} != $row->{alert_user_id};
+
my $hashref_restriction = $cobrand->site_restriction( $row->{cobrand_data} );
FixMyStreet::App->model('DB::AlertSent')->create( {
@@ -151,6 +154,7 @@ sub email_alerts ($) {
where nearby.problem_id = problem.id
and problem.user_id = users.id
and problem.state in ($states)
+ and problem.non_public = 'f'
and problem.confirmed >= ? and problem.confirmed >= ms_current_timestamp() - '7 days'::interval
and (select whenqueued from alert_sent where alert_sent.alert_id = ? and alert_sent.parameter::integer = problem.id) is null
and users.email <> ?