New field to show the day of the last activity

This commit is contained in:
Michael 2022-11-30 22:34:50 +00:00
parent fbcc56d42d
commit f905220923
8 changed files with 50 additions and 4 deletions

View file

@ -260,6 +260,17 @@ class Relation
return true;
}
/**
* Check if the cached suggestion is outdated
*
* @param integer $uid
* @return boolean
*/
static public function areSuggestionsOutdated(int $uid): bool
{
return DI::pConfig()->get($uid, 'suggestion', 'last_update') + 3600 < time();
}
/**
* Update contact suggestions for a given user
*
@ -268,7 +279,7 @@ class Relation
*/
static public function updateCachedSuggestions(int $uid)
{
if (DI::pConfig()->get($uid, 'suggestion', 'last_update') + 3600 > time()) {
if (!self::areSuggestionsOutdated($uid)) {
return;
}