]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/AllFriends.php
Ensure contact tabs will use the correct id
[friendica.git] / src / Module / AllFriends.php
index 10d33134654e593451a0dd037a598913d343269b..00614a1330a3d2c3a1ede367e061fc1a00dfea95 100644 (file)
@@ -22,7 +22,6 @@
 namespace Friendica\Module;
 
 use Friendica\BaseModule;
-use Friendica\Content\ContactSelector;
 use Friendica\Content\Pager;
 use Friendica\Core\Renderer;
 use Friendica\DI;
@@ -55,7 +54,7 @@ class AllFriends extends BaseModule
 
                $uid = $app->user['uid'];
 
-               $contact = Model\Contact::getContactForUser($cid, local_user(), ['name', 'url', 'photo', 'uid', 'id']);
+               $contact = Model\Contact::getById($cid, ['name', 'url', 'photo', 'uid', 'id']);
 
                if (empty($contact)) {
                        throw new HTTPException\BadRequestException(DI::l10n()->t('Invalid contact.'));
@@ -64,27 +63,22 @@ class AllFriends extends BaseModule
                DI::page()['aside'] = "";
                Model\Profile::load($app, "", Model\Contact::getByURL($contact["url"], false));
 
-               $total = Model\GContact::countAllFriends(local_user(), $cid);
+               $total = Model\Contact::countContactsOfContact($cid);
 
                $pager = new Pager(DI::l10n(), DI::args()->getQueryString());
 
-               $friends = Model\GContact::allFriends(local_user(), $cid, $pager->getStart(), $pager->getItemsPerPage());
+               $friends = Model\Contact::getContactsOfContact($cid, $pager->getStart(), $pager->getItemsPerPage());
                if (empty($friends)) {
                        return DI::l10n()->t('No friends to display.');
                }
 
-               $id = 0;
+               $tab_str = Contact::getTabsHTML($app, $contact, 4);
 
                $entries = [];
                foreach ($friends as $friend) {
-                       $contact = Model\Contact::getByURL($friend['url']);
-                       if (!empty($contact)) {
-                               $entries[] = Model\Contact::getTemplateData($contact, ++$id);
-                       }
+                       $entries[] = Contact::getContactTemplateVars($friend);
                }
 
-               $tab_str = Contact::getTabsHTML($app, $contact, 4);
-
                $tpl = Renderer::getMarkupTemplate('viewcontact_template.tpl');
                return Renderer::replaceMacros($tpl, [
                        '$tab_str'  => $tab_str,