]> git.mxchange.org Git - friendica.git/commitdiff
Issue 8547: Improve page load speed
authorMichael <heluecht@pirati.ca>
Sun, 7 Mar 2021 20:15:25 +0000 (20:15 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 7 Mar 2021 20:15:25 +0000 (20:15 +0000)
src/Content/ContactSelector.php
src/Module/Contact.php
src/Module/Group.php

index dbf7e0a468f5eee5eda5dbe5d633db48b41a6d99..9ff7bb865350e0afc353f443926a872b7ea45528 100644 (file)
@@ -117,7 +117,7 @@ class ContactSelector
         * @return string
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         */
-       public static function networkToName($network, $profile = '', $protocol = '')
+       public static function networkToName($network, $profile = '', $protocol = '', $gsid = 0)
        {
                $nets = [
                        Protocol::DFRN      =>   DI::l10n()->t('DFRN'),
@@ -147,7 +147,14 @@ class ContactSelector
                $networkname = str_replace($search, $replace, $network);
 
                if ((in_array($network, Protocol::FEDERATED)) && ($profile != "")) {
-                       $gserver = self::getServerForProfile($profile);
+                       if (!empty($gsid) && !empty(self::$serverdata[$gsid])) {
+                               $gserver = self::$serverdata[$gsid];
+                       } elseif (!empty($gsid)) {
+                               $gserver = DBA::selectFirst('gserver', ['platform', 'network'], ['id' => $gsid]);
+                               self::$serverdata[$gsid] = $gserver;
+                       } else {
+                               $gserver = self::getServerForProfile($profile);
+                       }
 
                        if (!empty($gserver['platform'])) {
                                $platform = $gserver['platform'];
index 4334d3130607b936fcf394ece767dab42c9364dc..235b8488abf45542c301259df5a1ad72cf902c61 100644 (file)
@@ -536,7 +536,7 @@ class Contact extends BaseModule
 
                        $poll_enabled = in_array($contact['network'], [Protocol::DFRN, Protocol::OSTATUS, Protocol::FEED, Protocol::MAIL]);
 
-                       $nettype = DI::l10n()->t('Network type: %s', ContactSelector::networkToName($contact['network'], $contact['url'], $contact['protocol']));
+                       $nettype = DI::l10n()->t('Network type: %s', ContactSelector::networkToName($contact['network'], $contact['url'], $contact['protocol'], $contact['gsid']));
 
                        // tabs
                        $tab_str = self::getTabsHTML($contact, self::TAB_PROFILE);
@@ -1113,7 +1113,7 @@ class Contact extends BaseModule
                        'account_type' => Model\Contact::getAccountType($contact),
                        'sparkle'      => $sparkle,
                        'itemurl'      => ($contact['addr'] ?? '') ?: $contact['url'],
-                       'network'      => ContactSelector::networkToName($contact['network'], $contact['url'], $contact['protocol']),
+                       'network'      => ContactSelector::networkToName($contact['network'], $contact['url'], $contact['protocol'], $contact['gsid']),
                ];
        }
 
index 8da062a93e9dfbfb9619725e45e4245164aa23d7..cd2cc444e6d3d23fd83801db1791bc84d2ed89ad 100644 (file)
@@ -319,7 +319,8 @@ class Group extends BaseModule
                        $contacts = Model\Contact\Group::listUngrouped(local_user());
                } else {
                        $contacts_stmt = DBA::select('contact', [],
-                               ['uid' => local_user(), 'pending' => false, 'blocked' => false, 'failed' => false, 'self' => false],
+                               ['rel' => [Model\Contact::FOLLOWER, Model\Contact::FRIEND, Model\Contact::SHARING],
+                               'uid' => local_user(), 'pending' => false, 'blocked' => false, 'failed' => false, 'self' => false],
                                ['order' => ['name']]
                        );
                        $contacts = DBA::toArray($contacts_stmt);