mirror of
https://github.com/friendica/friendica
synced 2024-11-18 22:23:42 +00:00
Don't probe non existing local contacts
This commit is contained in:
parent
aa6313dee6
commit
01abea7c25
1 changed files with 24 additions and 30 deletions
|
@ -2201,20 +2201,9 @@ class Probe
|
|||
*/
|
||||
private static function localProbe(string $url)
|
||||
{
|
||||
$uid = User::getIdForURL($url);
|
||||
if (empty($uid)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
if ($uid = User::getIdForURL($url)) {
|
||||
$profile = User::getOwnerDataById($uid);
|
||||
if (empty($profile)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$approfile = ActivityPub\Transmitter::getProfile($uid);
|
||||
if (empty($approfile)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (empty($profile['gsid'])) {
|
||||
$profile['gsid'] = GServer::getID($approfile['generator']['url']);
|
||||
|
@ -2234,6 +2223,11 @@ class Probe
|
|||
'sharedinbox' => $approfile['endpoints']['sharedInbox'], 'network' => Protocol::DFRN,
|
||||
'pubkey' => $profile['upubkey'], 'baseurl' => $approfile['generator']['url'], 'gsid' => $profile['gsid'],
|
||||
'manually-approve' => in_array($profile['page-flags'], [User::PAGE_FLAGS_NORMAL, User::PAGE_FLAGS_PRVGROUP])];
|
||||
} else {
|
||||
// Default values for non existing targets
|
||||
$data = ['name' => $url, 'nick' => $url, 'url' => $url, 'network' => Protocol::PHANTOM,
|
||||
'photo' => DI::baseUrl() . Contact::DEFAULT_AVATAR_PHOTO];
|
||||
}
|
||||
return self::rearrangeData($data);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue