aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Script
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/Script')
-rw-r--r--perllib/FixMyStreet/Script/Alerts.pm4
-rw-r--r--perllib/FixMyStreet/Script/Inactive.pm6
2 files changed, 10 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Script/Alerts.pm b/perllib/FixMyStreet/Script/Alerts.pm
index cb1f022fa..d07728092 100644
--- a/perllib/FixMyStreet/Script/Alerts.pm
+++ b/perllib/FixMyStreet/Script/Alerts.pm
@@ -307,6 +307,10 @@ sub _send_aggregated_alert_email(%) {
# Ignore phone-only users
return unless $data{alert_user}->email_verified;
+ # Mark user as active as they're being sent an alert
+ $data{alert_user}->set_last_active;
+ $data{alert_user}->update;
+
my $email = $data{alert_user}->email;
my ($domain) = $email =~ m{ @ (.*) \z }x;
return if $data{schema}->resultset('Abuse')->search( {
diff --git a/perllib/FixMyStreet/Script/Inactive.pm b/perllib/FixMyStreet/Script/Inactive.pm
index 8dd524ce1..4d28057d4 100644
--- a/perllib/FixMyStreet/Script/Inactive.pm
+++ b/perllib/FixMyStreet/Script/Inactive.pm
@@ -158,8 +158,14 @@ sub delete_reports {
sub anonymize_users {
my $self = shift;
+ my $body_users = FixMyStreet::DB->resultset("Body")->search({
+ comment_user_id => { '!=' => undef },
+ }, {
+ columns => 'comment_user_id',
+ });
my $users = FixMyStreet::DB->resultset("User")->search({
last_active => { '<', interval($self->anonymize) },
+ id => { -not_in => $body_users->as_query },
email => { -not_like => 'removed-%@' . FixMyStreet->config('EMAIL_DOMAIN') },
});