]> git.mxchange.org Git - friendica.git/commitdiff
Fix fallback on unknown contact
authorMichael <heluecht@pirati.ca>
Thu, 16 Jul 2020 04:18:33 +0000 (04:18 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 16 Jul 2020 04:18:33 +0000 (04:18 +0000)
mod/display.php
mod/suggest.php
src/Core/Search.php
src/Module/AllFriends.php
src/Module/Profile/Contacts.php
src/Module/Search/Index.php

index 61e1529e4dff6493ac25f9daea56aa966a914fcb..1a429948a9d8de8ae2342c03da49910bf4ec47a0 100644 (file)
@@ -164,7 +164,7 @@ function display_fetchauthor($a, $item)
                $profiledata["about"] = "";
        }
 
-       $profiledata = array_merge($profiledata, Contact::getByURLForUser($profiledata["url"], local_user()));
+       $profiledata = Contact::getByURLForUser($profiledata["url"], local_user()) ?: $profiledata;
 
        if (!empty($profiledata["photo"])) {
                $profiledata["photo"] = DI::baseUrl()->remove($profiledata["photo"]);
index 068b9e366bd81c1465177df45c577ea28060b182..9cd2fb1cd9b625fa015ff2a2bf2c44f5ab4e9267 100644 (file)
@@ -104,7 +104,7 @@ function suggest_content(App $a)
                        'hide' => [DI::l10n()->t('Ignore/Hide'), $ignlnk]
                ];
 
-               $contact_details = array_merge($rr, Contact::getByURLForUser($rr["url"], local_user()));
+               $contact_details = Contact::getByURLForUser($rr["url"], local_user()) ?: $rr;
 
                $entry = [
                        'url' => Contact::magicLink($rr['url']),
index d6ed9b6bfb362499a9cd6afbeaa4a03325a3516e..60137e66f7a972291362a7c4a224310a67cb2bfe 100644 (file)
@@ -202,7 +202,7 @@ class Search
                        return $resultList;
                }
 
-               $data = DBA::select('gcontact', ['nurl'], [
+               $data = DBA::select('gcontact', ['nurl', 'name', 'addr', 'url', 'photo', 'network', 'keywords'], [
                        'NOT `hide`
                        AND `network` IN (?, ?, ?, ?)
                        AND ((`last_contact` >= `last_failure`) OR (`updated` >= `last_failure`))
@@ -232,7 +232,7 @@ class Search
                                continue;
                        }
 
-                       $contact = Contact::getByURLForUser($row["nurl"], local_user());
+                       $contact = Contact::getByURLForUser($row["nurl"], local_user()) ?: $row;
 
                        if ($contact["name"] == "") {
                                $contact["name"] = end(explode("/", $urlParts["path"]));
@@ -245,8 +245,8 @@ class Search
                                $contact["url"],
                                $contact["photo"],
                                $contact["network"],
-                               $contact["cid"],
-                               $contact["zid"],
+                               $contact["cid"] ?? 0,
+                               $contact["zid"] ?? 0,
                                $contact["keywords"]
                        );
 
index 2932930627b05f11278e0ef7f8362e440edf4276..0a95256172220c83a86a6b4e0faf2100661bd22f 100644 (file)
@@ -79,7 +79,7 @@ class AllFriends extends BaseModule
                $entries = [];
                foreach ($friends as $friend) {
                        //get further details of the contact
-                       $contactDetails = array_merge($friend, Model\Contact::getByURLForUser($friend['url'], $uid));
+                       $contactDetails = Model\Contact::getByURLForUser($friend['url'], $uid) ?: $friend;
 
                        $connlnk = '';
                        // $friend[cid] is only available for common contacts. So if the contact is a common one, use contact_photo_menu to generate the photoMenu
index 508fe376246b44013809133163a7317b6f0cdee7..3d55c57f48c10c4b4fdd6fcb0c9bd337af67585a 100644 (file)
@@ -103,7 +103,7 @@ class Contacts extends BaseProfile
                                continue;
                        }
 
-                       $contact_details = array_merge($contact, Contact::getByURLForUser($contact['url'], $a->profile['uid']));
+                       $contact_details = Contact::getByURLForUser($contact['url'], $a->profile['uid']) ?: $contact;
 
                        $contacts[] = [
                                'id'           => $contact['id'],
index 34085e339e0a4f52fff5c23f384d1c8c1b49a155..23f12d2638df0ce3ac1e5548d767207a4c4e4c48 100644 (file)
@@ -239,7 +239,7 @@ class Index extends BaseSearch
                        if ($isAddr) {
                                $contact = Contact::selectFirst(['id'], ['addr' => $search, 'uid' => 0]);
                        } else {
-                               $contact = array_merge(['id' => 0], Contact::getByURL($search, null, ['id']));
+                               $contact = Contact::getByURL($search, null, ['id']) ?: ['id' => 0];
                        }
 
                        if (DBA::isResult($contact)) {