]> git.mxchange.org Git - friendica.git/blobdiff - src/Content/Widget/VCard.php
Merge pull request #11532 from tobiasd/2022.05-CHANGELOG
[friendica.git] / src / Content / Widget / VCard.php
index a44f8f0b4a7ece6400864b04f25135620ebe76da..96f35e6584503f2aec7cd7a2fe9dbba6ab0ce03a 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2022, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -62,20 +62,26 @@ class VCard
                $unfollow_link    = '';
                $wallmessage_link = '';
 
+               $photo   = Contact::getPhoto($contact);
+
                if (local_user()) {
                        if ($contact['uid']) {
                                $id      = $contact['id'];
                                $rel     = $contact['rel'];
                                $pending = $contact['pending'];
                        } else {
-                               $pcontact = Contact::selectFirst(['id', 'rel', 'pending'], ['uid' => local_user(), 'uri-id' => $contact['uri-id']]);
+                               $pcontact = Contact::selectFirst([], ['uid' => local_user(), 'uri-id' => $contact['uri-id']]);
 
                                $id      = $pcontact['id'] ?? 0;
                                $rel     = $pcontact['rel'] ?? Contact::NOTHING;
                                $pending = $pcontact['pending'] ?? false;
+
+                               if (!empty($pcontact) && in_array($pcontact['network'], [Protocol::MAIL, Protocol::FEED])) {
+                                       $photo = Contact::getPhoto($pcontact);
+                               }
                        }
 
-                       if (in_array($contact['network'], Protocol::NATIVE_SUPPORT)) {
+                       if (empty($contact['self']) && Protocol::supportsFollow($contact['network'])) {
                                if (in_array($rel, [Contact::SHARING, Contact::FRIEND])) {
                                        $unfollow_link = 'unfollow?url=' . urlencode($contact['url']) . '&auto=1';
                                } elseif (!$pending) {
@@ -90,7 +96,7 @@ class VCard
 
                return Renderer::replaceMacros(Renderer::getMarkupTemplate('widget/vcard.tpl'), [
                        '$contact'          => $contact,
-                       '$photo'            => Contact::getPhoto($contact),
+                       '$photo'            => $photo,
                        '$url'              => Contact::magicLinkByContact($contact, $contact['url']),
                        '$about'            => BBCode::convertForUriId($contact['uri-id'] ?? 0, $contact['about'] ?? ''),
                        '$xmpp'             => DI::l10n()->t('XMPP:'),
@@ -99,7 +105,7 @@ class VCard
                        '$network_link'     => $network_link,
                        '$network_avatar'   => $network_avatar,
                        '$network'          => DI::l10n()->t('Network:'),
-                       '$account_type'     => Contact::getAccountType($contact),
+                       '$account_type'     => Contact::getAccountType($contact['contact-type']),
                        '$follow'           => DI::l10n()->t('Follow'),
                        '$follow_link'      => $follow_link,
                        '$unfollow'         => DI::l10n()->t('Unfollow'),