From faf8952b8732d6314e3d3429f5cc761564565e44 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 14 Feb 2022 21:58:30 +0100 Subject: Send inactivity notification prior to account deletion --- lib/Travelynx/Model/Users.pm | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'lib/Travelynx/Model/Users.pm') diff --git a/lib/Travelynx/Model/Users.pm b/lib/Travelynx/Model/Users.pm index 1371b8a..70d81c4 100644 --- a/lib/Travelynx/Model/Users.pm +++ b/lib/Travelynx/Model/Users.pm @@ -23,8 +23,25 @@ sub mark_seen { $db->update( 'users', - { last_seen => DateTime->now( time_zone => 'Europe/Berlin' ) }, - { id => $uid } + { + last_seen => DateTime->now( time_zone => 'Europe/Berlin' ), + deletion_notified => undef + }, + { id => $uid } + ); +} + +sub mark_deletion_notified { + my ( $self, %opt ) = @_; + my $uid = $opt{uid}; + my $db = $opt{db} // $self->{pg}->db; + + $db->update( + 'users', + { + deletion_notified => DateTime->now( time_zone => 'Europe/Berlin' ), + }, + { id => $uid } ); } -- cgit v1.2.3