1
0
Fork 0

Ensure contact tabs will use the correct id

This commit is contained in:
Michael 2020-08-02 13:34:49 +00:00
commit 91c360638a
5 changed files with 95 additions and 34 deletions

View file

@ -54,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.'));
@ -63,25 +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.');
}
$tab_str = Contact::getTabsHTML($app, $contact, 4);
$entries = [];
foreach ($friends as $friend) {
$contact = Model\Contact::getByURLForUser($friend['url'], local_user());
if (!empty($contact)) {
$entries[] = Contact::getContactTemplateVars($contact);
}
$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,