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

index 0abdd3ed6f2e5135a36b2a40d6991bdfb2091d6e..3eee5da0992970aadd6dde928134e9d55022644d 100644 (file)
@@ -100,7 +100,18 @@ class Common extends BaseProfile
 
                $commonFollows = Contact\Relation::listCommon($sourceId, $targetId, $condition, $pager->getItemsPerPage(), $pager->getStart());
 
-               $contacts = array_map([Module\Contact::class, 'getContactTemplateVars'], $commonFollows);
+               // Contact list is obtained from the visited profile user, but the contact display is visitor dependent
+               $contacts = array_map(
+                       function ($contact) {
+                               $contact = Contact::selectFirst(
+                                       [],
+                                       ['uri-id' => $contact['uri-id'], 'uid' => [0, $this->userSession->getLocalUserId()]],
+                                       ['order' => ['uid' => 'DESC']]
+                               );
+                               return Module\Contact::getContactTemplateVars($contact);
+                       },
+                       $commonFollows
+               );
 
                $title = $this->tt('Common contact (%s)', 'Common contacts (%s)', $total);
                $desc = $this->t(