Update AP Helpers, update bio + name

This commit is contained in:
Daniel Supernault 2020-06-13 00:21:41 -06:00
parent 5c44354880
commit 4bee8397e0
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7
1 changed files with 14 additions and 0 deletions

View File

@ -131,6 +131,10 @@ class Helpers {
public static function validateUrl($url)
{
if(is_array($url)) {
$url = $url[0];
}
$localhosts = [
'127.0.0.1', 'localhost', '::1'
];
@ -433,6 +437,16 @@ class Helpers {
// RemoteFollowImportRecent::dispatch($res, $profile);
CreateAvatar::dispatch($profile);
}
} else {
// Update info after 24 hours
if($profile->last_fetched_at == null ||
$profile->last_fetched_at->lt(now()->subHours(24)) == true
) {
$profile->name = isset($res['name']) ? Purify::clean($res['name']) : 'user';
$profile->bio = isset($res['summary']) ? Purify::clean($res['summary']) : null;
$profile->last_fetched_at = now();
$profile->save();
}
}
return $profile;
}