diff options
author | Matthew Somerville <matthew@mysociety.org> | 2020-05-27 21:01:10 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2020-06-03 17:24:12 +0100 |
commit | 5412a569e233b82c8f971e07c57c73d2ef3f6733 (patch) | |
tree | 22c417502f49b705c278f6e71c2375d2c32780d3 | |
parent | f8859e29f5bcf75c1b2acb934bd4353f83c5a2c1 (diff) |
Mark user as active when sent an email alert.
-rw-r--r-- | CHANGELOG.md | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/Script/Alerts.pm | 4 | ||||
-rw-r--r-- | t/app/controller/alert_new.t | 2 |
3 files changed, 8 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a2466913..05663b366 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ ## Releases * Unreleased + - Changes: + - Mark user as active when sent an email alert. - Bugfixes: - Fix issue with dashboard report CSV export. #3026 - bin/update-schema PostgreSQL 12 compatibility. #3043 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/t/app/controller/alert_new.t b/t/app/controller/alert_new.t index 7eba90530..d968b56b1 100644 --- a/t/app/controller/alert_new.t +++ b/t/app/controller/alert_new.t @@ -523,6 +523,8 @@ subtest "Test alerts are not sent for no-text updates" => sub { }; $mech->email_count_is(1); + $user2->discard_changes; + isnt $user2->last_active, undef, 'Last active has been set'; $mech->delete_user($user1); $mech->delete_user($user2); |