]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Contact.php
Ensure that cached avatar fields are set
[friendica.git] / src / Module / Contact.php
index 9f347154044f39334313aa57191b453c24c70d52..e9f00a1b653d6086e0a46b471324ac72a4f795b8 100644 (file)
@@ -36,6 +36,7 @@ use Friendica\Core\Worker;
 use Friendica\Database\DBA;
 use Friendica\DI;
 use Friendica\Model;
+use Friendica\Model\Contact as ModelContact;
 use Friendica\Module\Security\Login;
 use Friendica\Network\HTTPException\BadRequestException;
 use Friendica\Network\HTTPException\NotFoundException;
@@ -112,7 +113,7 @@ class Contact extends BaseModule
                }
 
                if (!DBA::exists('contact', ['id' => $contact_id, 'uid' => local_user(), 'deleted' => false])) {
-                       notice(DI::l10n()->t('Could not access contact record.') . EOL);
+                       notice(DI::l10n()->t('Could not access contact record.'));
                        DI::baseUrl()->redirect('contact');
                        return; // NOTREACHED
                }
@@ -144,10 +145,8 @@ class Contact extends BaseModule
                        ['id' => $contact_id, 'uid' => local_user()]
                );
 
-               if (DBA::isResult($r)) {
-                       info(DI::l10n()->t('Contact updated.') . EOL);
-               } else {
-                       notice(DI::l10n()->t('Failed to update contact record.') . EOL);
+               if (!DBA::isResult($r)) {
+                       notice(DI::l10n()->t('Failed to update contact record.'));
                }
 
                $contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user(), 'deleted' => false]);
@@ -280,6 +279,8 @@ class Contact extends BaseModule
                        if ($contact['network'] == Protocol::PHANTOM) {
                                $contact = false;
                        }
+
+                       $contact = ModelContact::checkAvatarCacheArray($contact);
                }
 
                if (DBA::isResult($contact)) {
@@ -366,7 +367,7 @@ class Contact extends BaseModule
                Nav::setSelected('contact');
 
                if (!local_user()) {
-                       notice(DI::l10n()->t('Permission denied.') . EOL);
+                       notice(DI::l10n()->t('Permission denied.'));
                        return Login::form();
                }
 
@@ -400,7 +401,7 @@ class Contact extends BaseModule
                                self::blockContact($contact_id);
 
                                $blocked = Model\Contact::isBlockedByUser($contact_id, local_user());
-                               info(($blocked ? DI::l10n()->t('Contact has been blocked') : DI::l10n()->t('Contact has been unblocked')) . EOL);
+                               info(($blocked ? DI::l10n()->t('Contact has been blocked') : DI::l10n()->t('Contact has been unblocked')));
 
                                DI::baseUrl()->redirect('contact/' . $contact_id);
                                // NOTREACHED
@@ -410,7 +411,7 @@ class Contact extends BaseModule
                                self::ignoreContact($contact_id);
 
                                $ignored = Model\Contact::isIgnoredByUser($contact_id, local_user());
-                               info(($ignored ? DI::l10n()->t('Contact has been ignored') : DI::l10n()->t('Contact has been unignored')) . EOL);
+                               info(($ignored ? DI::l10n()->t('Contact has been ignored') : DI::l10n()->t('Contact has been unignored')));
 
                                DI::baseUrl()->redirect('contact/' . $contact_id);
                                // NOTREACHED
@@ -420,7 +421,7 @@ class Contact extends BaseModule
                                $r = self::archiveContact($contact_id, $orig_record);
                                if ($r) {
                                        $archived = (($orig_record['archive']) ? 0 : 1);
-                                       info((($archived) ? DI::l10n()->t('Contact has been archived') : DI::l10n()->t('Contact has been unarchived')) . EOL);
+                                       info((($archived) ? DI::l10n()->t('Contact has been archived') : DI::l10n()->t('Contact has been unarchived')));
                                }
 
                                DI::baseUrl()->redirect('contact/' . $contact_id);
@@ -461,7 +462,7 @@ class Contact extends BaseModule
                                }
 
                                self::dropContact($orig_record);
-                               info(DI::l10n()->t('Contact has been removed.') . EOL);
+                               info(DI::l10n()->t('Contact has been removed.'));
 
                                DI::baseUrl()->redirect('contact');
                                // NOTREACHED
@@ -971,7 +972,7 @@ class Contact extends BaseModule
                if (DBA::isResult($contact)) {
                        DI::page()['aside'] = '';
 
-                       $profiledata = Model\Contact::getDetailsByURL($contact['url']);
+                       $profiledata = Model\Contact::getByURL($contact['url'], false);
 
                        Model\Profile::load($a, '', $profiledata, true);
 
@@ -994,7 +995,7 @@ class Contact extends BaseModule
                if (DBA::isResult($contact)) {
                        DI::page()['aside'] = '';
 
-                       $profiledata = Model\Contact::getDetailsByURL($contact['url']);
+                       $profiledata = Model\Contact::getByURL($contact['url'], false);
 
                        if (local_user() && in_array($profiledata['network'], Protocol::FEDERATED)) {
                                $profiledata['remoteconnect'] = DI::baseUrl() . '/follow?url=' . urlencode($profiledata['url']);