Set timestamp when mod logs in

This commit is contained in:
swag 2023-01-08 23:03:55 -05:00
parent 6be8cc43a9
commit f48c139ad9
3 changed files with 11 additions and 1 deletions

View File

@ -32,7 +32,8 @@ Run the tests locally (against development environment):
## TODOs ## 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. Actions for creating moderators and resetting passwords
1. CSS 1. CSS
1. "All new posts flagged" mode (require approval for new posts) 1. "All new posts flagged" mode (require approval for new posts)

View File

@ -58,6 +58,7 @@ sub login($self) {
author => $mod_name author => $mod_name
); );
$self->flash(info => "Hello, $mod_name 😎"); $self->flash(info => "Hello, $mod_name 😎");
$self->moderator->login_timestamp($mod_id);
return $self->redirect_to('flagged_list'); return $self->redirect_to('flagged_list');
} }

View File

@ -47,6 +47,14 @@ sub get_name($self, $mod_id) {
END_SQL 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) { sub unflag_thread($self, $thread_id) {
$self->pg->db->query(<<~'END_SQL', $thread_id) $self->pg->db->query(<<~'END_SQL', $thread_id)
UPDATE threads UPDATE threads