From: Michael Date: Mon, 3 Aug 2020 18:21:56 +0000 (+0000) Subject: Use the new relation functions X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ee1cb93f3a39dfa1bd277cfecbf211fd77bcd469;p=friendica.git Use the new relation functions --- diff --git a/src/Model/GContact.php b/src/Model/GContact.php index 78583bcc5a..3fe123e15f 100644 --- a/src/Model/GContact.php +++ b/src/Model/GContact.php @@ -22,9 +22,7 @@ namespace Friendica\Model; use Exception; -use Friendica\Database\DBA; use Friendica\DI; -use Friendica\Util\DateTimeFormat; /** * This class handles GlobalContact related functions @@ -138,32 +136,4 @@ LIMIT 1", return Contact\Relation::listCommonFollows($sourceId, $targetPublicContact['id'] ?? 0, $condition, $limit, $start, $shuffle); } - - /** - * @param integer $uid user - * @param integer $cid cid - * @return integer - * @throws Exception - */ - public static function countAllFriends($uid, $cid) - { - $cids = Contact::getPublicAndUserContacID($cid, $uid); - - return Contact\Relation::countFollows($cids['public'] ?? 0); - } - - /** - * @param integer $uid user - * @param integer $cid cid - * @param integer $start optional, default 0 - * @param integer $limit optional, default 80 - * @return array - * @throws Exception - */ - public static function allFriends($uid, $cid, $start = 0, $limit = 80) - { - $cids = Contact::getPublicAndUserContacID($cid, $uid); - - return Contact\Relation::listFollows($cids['public'] ?? 0, [], $limit, $start); - } } diff --git a/src/Module/AllFriends.php b/src/Module/AllFriends.php index 00614a1330..f25f751c27 100644 --- a/src/Module/AllFriends.php +++ b/src/Module/AllFriends.php @@ -63,11 +63,11 @@ class AllFriends extends BaseModule DI::page()['aside'] = ""; Model\Profile::load($app, "", Model\Contact::getByURL($contact["url"], false)); - $total = Model\Contact::countContactsOfContact($cid); + $total = Model\Contact\Relation::countFollows($cid); $pager = new Pager(DI::l10n(), DI::args()->getQueryString()); - $friends = Model\Contact::getContactsOfContact($cid, $pager->getStart(), $pager->getItemsPerPage()); + $friends = Model\Contact\Relation::listFollows($cid, [], $pager->getStart(), $pager->getItemsPerPage()); if (empty($friends)) { return DI::l10n()->t('No friends to display.'); } diff --git a/src/Module/Contact.php b/src/Module/Contact.php index 73be9ecab5..b8c8827b24 100644 --- a/src/Module/Contact.php +++ b/src/Module/Contact.php @@ -901,7 +901,7 @@ class Contact extends BaseModule ]; // Show this tab only if there is visible friend list - $x = Model\Contact::countContactsOfContact($pcid); + $x = Model\Contact\Relation::countFollows($pcid); if ($x) { $tabs[] = ['label' => DI::l10n()->t('Contacts'), 'url' => "allfriends/" . $pcid,