1
0
Fork 0
mirror of synced 2024-10-01 01:37:56 +13:00

Merge pull request #7292 from appwrite/fix-7147-user-last-activity-not-updating

Fix user last activity not updating
This commit is contained in:
Torsten Dittmann 2023-12-28 01:59:23 +01:00 committed by GitHub
commit d9b300051a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -556,6 +556,22 @@ App::shutdown()
->setParam('project.{scope}.network.outbound', $response->getSize()) ->setParam('project.{scope}.network.outbound', $response->getSize())
->submit(); ->submit();
} }
/**
* Update user last activity
*/
if (!$user->isEmpty()) {
$accessedAt = $user->getAttribute('accessedAt', '');
if (DateTime::formatTz(DateTime::addSeconds(new \DateTime(), -APP_USER_ACCCESS)) > $accessedAt) {
$user->setAttribute('accessedAt', DateTime::now());
if (APP_MODE_ADMIN !== $mode) {
$dbForProject->updateDocument('users', $user->getId(), $user);
} else {
$dbForConsole->updateDocument('users', $user->getId(), $user);
}
}
}
}); });
App::init() App::init()