diff --git a/README.md b/README.md index b7bf07d..ecfe50c 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,8 @@ Run the tests locally (against development environment): ## TODOs -1. Increment last_login_date when loggin in!! +1. Link to hidden posts for mods +1. lock_status isn't doing anything!! 1. Actions for creating moderators and resetting passwords 1. CSS 1. "All new posts flagged" mode (require approval for new posts) diff --git a/lib/PostText/Controller/Moderator.pm b/lib/PostText/Controller/Moderator.pm index 67d894e..62402b5 100644 --- a/lib/PostText/Controller/Moderator.pm +++ b/lib/PostText/Controller/Moderator.pm @@ -58,6 +58,7 @@ sub login($self) { author => $mod_name ); $self->flash(info => "Hello, $mod_name 😎"); + $self->moderator->login_timestamp($mod_id); return $self->redirect_to('flagged_list'); } diff --git a/lib/PostText/Model/Moderator.pm b/lib/PostText/Model/Moderator.pm index 9efc34f..9bab22a 100644 --- a/lib/PostText/Model/Moderator.pm +++ b/lib/PostText/Model/Moderator.pm @@ -47,6 +47,14 @@ sub get_name($self, $mod_id) { END_SQL } +sub login_timestamp($self, $mod_id) { + $self->pg->db->query(<<~'END_SQL', $mod_id); + UPDATE moderators + SET last_login_date = NOW() + WHERE moderator_id = ?; + END_SQL +} + sub unflag_thread($self, $thread_id) { $self->pg->db->query(<<~'END_SQL', $thread_id) UPDATE threads