]> git.mxchange.org Git - friendica.git/commitdiff
Retrieve contact records for the page visitor in Profile\Contacts module
authorHypolite Petovan <hypolite@mrpetovan.com>
Sat, 17 Dec 2022 05:37:40 +0000 (00:37 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Mon, 19 Dec 2022 14:50:17 +0000 (09:50 -0500)
src/Module/Profile/Contacts.php

index 81ccd500d5e56a332fa13b8bf00ff5a7cd99daaa..f8cfe37efdd44364b1632348520b5c9b67590fc2 100644 (file)
@@ -113,9 +113,17 @@ class Contacts extends Module\BaseProfile
 
                $params = ['order' => ['name' => false], 'limit' => [$pager->getStart(), $pager->getItemsPerPage()]];
 
+               // Contact list is obtained from the visited profile user, but the contact display is visitor dependent
                $contacts = array_map(
-                       [Module\Contact::class, 'getContactTemplateVars'],
-                       Model\Contact::selectToArray([], $condition, $params)
+                       function ($contact) {
+                               $contact = Model\Contact::selectFirst(
+                                       [],
+                                       ['uri-id' => $contact['uri-id'], 'uid' => [0, $this->userSession->getLocalUserId()]],
+                                       ['order' => ['uid' => 'DESC']]
+                               );
+                               return Module\Contact::getContactTemplateVars($contact);
+                       },
+                       Model\Contact::selectToArray(['uri-id'], $condition, $params)
                );
 
                $desc = '';