Merge pull request #7292 from appwrite/fix-7147-user-last-activity-not-updating
Fix user last activity not updating
This commit is contained in:
commit
d9b300051a
1 changed files with 16 additions and 0 deletions
|
@ -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()
|
||||||
|
|
Loading…
Reference in a new issue