]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Circle.php
Changes:
[friendica.git] / src / Module / Circle.php
index 74d52ee6299c3027c791dd9acb2fe356f7c2e0e6..98a29411d3cc91d06410454781c42d2ff4b728f8 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2023, the Friendica project
+ * @copyright Copyright (C) 2010-2024, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -22,6 +22,7 @@
 namespace Friendica\Module;
 
 use Friendica\BaseModule;
+use Friendica\Content\Widget;
 use Friendica\Core\Renderer;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
@@ -131,10 +132,10 @@ class Circle extends BaseModule
                        }
 
                        DI::sysmsg()->addInfo($message);
-                       System::jsonExit(['status' => 'OK', 'message' => $message]);
+                       $this->jsonExit(['status' => 'OK', 'message' => $message]);
                } catch (\Exception $e) {
                        DI::sysmsg()->addNotice($e->getMessage());
-                       System::jsonError($e->getCode(), ['status' => 'error', 'message' => $e->getMessage()]);
+                       $this->jsonError($e->getCode(), ['status' => 'error', 'message' => $e->getMessage()]);
                }
        }
 
@@ -146,8 +147,6 @@ class Circle extends BaseModule
                        throw new \Friendica\Network\HTTPException\ForbiddenException();
                }
 
-               $a = DI::app();
-
                DI::page()['aside'] = Model\Circle::sidebarWidget('contact', 'circle', 'extended', ((DI::args()->getArgc() > 1) ? DI::args()->getArgv()[1] : 'everyone'));
 
                // With no circle number provided we jump to the unassigned contacts as a starting point
@@ -319,11 +318,13 @@ class Circle extends BaseModule
                if ($nocircle) {
                        $contacts = Model\Contact\Circle::listUncircled(DI::userSession()->getLocalUserId());
                } else {
-                       $contacts_stmt = DBA::select('contact', [],
-                               ['rel' => [Model\Contact::FOLLOWER, Model\Contact::FRIEND, Model\Contact::SHARING],
-                               'uid' => DI::userSession()->getLocalUserId(), 'pending' => false, 'blocked' => false, 'failed' => false, 'self' => false],
-                               ['order' => ['name']]
-                       );
+                       $networks = Widget::unavailableNetworks();
+                       $query = "`uid` = ? AND NOT `self` AND NOT `deleted` AND NOT `blocked` AND NOT `pending` AND NOT `failed`
+                               AND `rel` IN (?, ?, ?)
+                               AND NOT `network` IN (" . substr(str_repeat('?, ', count($networks)), 0, -2) . ")";
+                       $condition = array_merge([$query], [DI::userSession()->getLocalUserId(), Model\Contact::FOLLOWER, Model\Contact::FRIEND, Model\Contact::SHARING], $networks);
+
+                       $contacts_stmt = DBA::select('contact', [], $condition, ['order' => ['name']]);
                        $contacts = DBA::toArray($contacts_stmt);
                        $context['$desc'] = DI::l10n()->t('Click on a contact to add or remove.');
                }