From 2d9633a595b8e315f8317fdecb5b84fb73515489 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 17 Dec 2022 00:49:19 -0500 Subject: [PATCH] Retrieve contact records for the page visitor in Profile\Common module --- src/Module/Profile/Common.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Module/Profile/Common.php b/src/Module/Profile/Common.php index 0abdd3ed6f..3eee5da099 100644 --- a/src/Module/Profile/Common.php +++ b/src/Module/Profile/Common.php @@ -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( -- 2.39.5