Merge pull request #7645 from annando/fix-probe

Fix: updateFromProbe failed when updating non-federated networks
This commit is contained in:
Hypolite Petovan 2019-09-20 19:50:10 -04:00 committed by GitHub
commit 7e600df9a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1463,7 +1463,6 @@ class Contact extends BaseObject
if (empty($data)) { if (empty($data)) {
$data = Probe::uri($url, "", $uid); $data = Probe::uri($url, "", $uid);
// Ensure that there is a gserver entry // Ensure that there is a gserver entry
if (!empty($data['baseurl']) && ($data['network'] != Protocol::PHANTOM)) { if (!empty($data['baseurl']) && ($data['network'] != Protocol::PHANTOM)) {
PortableContact::checkServer($data['baseurl']); PortableContact::checkServer($data['baseurl']);
@ -2022,9 +2021,8 @@ class Contact extends BaseObject
return true; return true;
} }
// If Probe::uri fails the network code will be different (mostly "feed" or "unkn") // If Probe::uri fails the network code will be different ("feed" or "unkn")
if (!in_array($ret['network'], Protocol::NATIVE_SUPPORT) || if (in_array($ret['network'], [Protocol::FEED, Protocol::PHANTOM]) && ($ret['network'] != $contact['network'])) {
(in_array($ret['network'], [Protocol::FEED, Protocol::PHANTOM]) && ($ret['network'] != $contact['network']))) {
if ($force && ($uid == 0)) { if ($force && ($uid == 0)) {
self::updateContact($id, $uid, $ret['url'], ['last-update' => $updated, 'failure_update' => $updated]); self::updateContact($id, $uid, $ret['url'], ['last-update' => $updated, 'failure_update' => $updated]);
} }
@ -2064,7 +2062,7 @@ class Contact extends BaseObject
} }
} }
if ($ret['network'] != Protocol::FEED) { if (!empty($ret['photo']) && ($ret['network'] != Protocol::FEED)) {
self::updateAvatar($ret['photo'], $uid, $id, $update || $force); self::updateAvatar($ret['photo'], $uid, $id, $update || $force);
} }