From: Michael Date: Sat, 6 Jun 2020 08:11:19 +0000 (+0000) Subject: Issue 8735: Ensure the correct data type for "hide" X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=bc4e5b4d6922f65197ef99ecf6f8cb2f10019057;p=friendica.git Issue 8735: Ensure the correct data type for "hide" --- diff --git a/src/Model/GContact.php b/src/Model/GContact.php index 3da5513b50..fb4df9a63a 100644 --- a/src/Model/GContact.php +++ b/src/Model/GContact.php @@ -627,11 +627,6 @@ class GContact $contact['network'] = Protocol::OSTATUS; } - // All new contacts are hidden by default - if (!isset($contact['hide'])) { - $contact['hide'] = true; - } - // Remove unwanted parts from the contact url (e.g. '?zrl=...') if (in_array($contact['network'], Protocol::FEDERATED)) { $contact['url'] = self::cleanContactUrl($contact['url']); @@ -646,6 +641,7 @@ class GContact $contact['location'] = $contact['location'] ?? ''; $contact['about'] = $contact['about'] ?? ''; $contact['generation'] = $contact['generation'] ?? 0; + $contact['hide'] = $contact['hide'] ?? true; $fields = ['name' => $contact['name'], 'nick' => $contact['nick'] ?? '', 'addr' => $contact['addr'] ?? '', 'network' => $contact['network'], 'url' => $contact['url'], 'nurl' => Strings::normaliseLink($contact['url']), 'photo' => $contact['photo'], diff --git a/src/Network/Probe.php b/src/Network/Probe.php index db4ef517d5..7a6711c5f1 100644 --- a/src/Network/Probe.php +++ b/src/Network/Probe.php @@ -92,7 +92,11 @@ class Probe $newdata = []; foreach ($fields as $field) { if (isset($data[$field])) { - $newdata[$field] = $data[$field]; + if (in_array($field, ["gsid", "hide", "account-type"])) { + $newdata[$field] = (int)$data[$field]; + } else { + $newdata[$field] = $data[$field]; + } } elseif ($field != "gsid") { $newdata[$field] = ""; } else { @@ -398,7 +402,7 @@ class Probe // When the previous detection process had got a time out // we could falsely detect a Friendica profile as AP profile. if (!self::$istimeout) { - $ap_profile = ActivityPub::probeProfile($uri); + $ap_profile = ActivityPub::probeProfile($uri, !$cache); if (empty($data) || (!empty($ap_profile) && empty($network) && (($data['network'] ?? '') != Protocol::DFRN))) { $data = $ap_profile;