summaryrefslogtreecommitdiff
path: root/lib/Travelynx.pm
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-04-30 12:47:32 +0200
committerDaniel Friesel <derf@finalrewind.org>2019-04-30 12:48:23 +0200
commit99aa3a4a0d467fd83ba78096cf34113df797f0d8 (patch)
tree3a6e4dc9b7a7bcdb73fd3071dcca3e68c218702b /lib/Travelynx.pm
parent867a5d4afbb3a5c0ad0e5dfbc10d2516e3e9123f (diff)
Implement deletion of inactive accounts
Diffstat (limited to 'lib/Travelynx.pm')
-rwxr-xr-xlib/Travelynx.pm18
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm
index d828f84..99d0fb2 100755
--- a/lib/Travelynx.pm
+++ b/lib/Travelynx.pm
@@ -578,6 +578,18 @@ sub startup {
);
$self->helper(
+ 'mark_seen' => sub {
+ my ( $self, $uid ) = @_;
+
+ $self->pg->db->update(
+ 'users',
+ { last_seen => DateTime->now( time_zone => 'Europe/Berlin' ) },
+ { id => $uid }
+ );
+ }
+ );
+
+ $self->helper(
'update_journey_part' => sub {
my ( $self, $db, $journey_id, $key, $value ) = @_;
my $rows;
@@ -878,7 +890,7 @@ sub startup {
'users',
'id, name, status, public_level, email, '
. 'extract(epoch from registered_at) as registered_at_ts, '
- . 'extract(epoch from last_login) as last_login_ts, '
+ . 'extract(epoch from last_seen) as last_seen_ts, '
. 'extract(epoch from deletion_requested) as deletion_requested_ts',
{ id => $uid }
)->hash;
@@ -895,7 +907,7 @@ sub startup {
time_zone => 'Europe/Berlin'
),
last_seen => DateTime->from_epoch(
- epoch => $user_data->{last_login_ts},
+ epoch => $user_data->{last_seen_ts},
time_zone => 'Europe/Berlin'
),
deletion_requested => $user_data->{deletion_requested_ts}
@@ -967,7 +979,7 @@ sub startup {
token => $token,
password => $password,
registered_at => $now,
- last_login => $now,
+ last_seen => $now,
},
{ returning => 'id' }
);