]> git.mxchange.org Git - friendica.git/commitdiff
Don't search for contacts on blocked or failed systems
authorMichael <heluecht@pirati.ca>
Tue, 28 Mar 2023 05:33:14 +0000 (05:33 +0000)
committerMichael <heluecht@pirati.ca>
Tue, 28 Mar 2023 05:33:14 +0000 (05:33 +0000)
database.sql
src/Model/Contact.php
static/dbstructure.config.php
static/dbview.config.php

index eefd38984082dc6ce76a745c899f05869c645a21..42a6c1f2e6210c3ce7ee9c1cf7a222d4239ea714 100644 (file)
@@ -1,6 +1,6 @@
 -- ------------------------------------------
 -- Friendica 2023.03-rc (Giant Rhubarb)
--- DB_UPDATE_VERSION 1517
+-- DB_UPDATE_VERSION 1518
 -- ------------------------------------------
 
 
@@ -2849,7 +2849,9 @@ CREATE VIEW `account-view` AS SELECT
        `apcontact`.`statuses_count` AS `ap-statuses_count`,
        `gserver`.`site_name` AS `site_name`,
        `gserver`.`platform` AS `platform`,
-       `gserver`.`version` AS `version`
+       `gserver`.`version` AS `version`,
+       `gserver`.`blocked` AS `server-blocked`,
+       `gserver`.`failed` AS `server-failed`
        FROM `contact`
                        LEFT JOIN `item-uri` ON `item-uri`.`id` = `contact`.`uri-id`
                        LEFT JOIN `apcontact` ON `apcontact`.`uri-id` = `contact`.`uri-id`
@@ -2953,7 +2955,9 @@ CREATE VIEW `account-user-view` AS SELECT
        `apcontact`.`statuses_count` AS `ap-statuses_count`,
        `gserver`.`site_name` AS `site_name`,
        `gserver`.`platform` AS `platform`,
-       `gserver`.`version` AS `version`
+       `gserver`.`version` AS `version`,
+       `gserver`.`blocked` AS `server-blocked`,
+       `gserver`.`failed` AS `server-failed`
        FROM `contact` AS `ucontact`
                        INNER JOIN `contact` ON `contact`.`uri-id` = `ucontact`.`uri-id` AND `contact`.`uid` = 0
                        LEFT JOIN `item-uri` ON `item-uri`.`id` = `ucontact`.`uri-id`
index 8792273eeff4d9b2ffed05051da47450280f8e62..54689fb624afdbd4bf3faa390b255a0e97bddad3 100644 (file)
@@ -3529,7 +3529,14 @@ class Contact
                        $networks[] = Protocol::OSTATUS;
                }
 
-               $condition = ['network' => $networks, 'failed' => false, 'deleted' => false, 'uid' => $uid];
+               $condition = [
+                       'network'        => $networks,
+                       'server-failed'  => false,
+                       'server-blocked' => false,
+                       'failed'         => false,
+                       'deleted'        => false,
+                       'uid'            => $uid
+               ];
 
                if ($uid == 0) {
                        $condition['blocked'] = false;
@@ -3556,7 +3563,7 @@ class Contact
                        ["(NOT `unsearchable` OR `nurl` IN (SELECT `nurl` FROM `owner-view` WHERE `publish` OR `net-publish`))
                        AND (`addr` LIKE ? OR `name` LIKE ? OR `nick` LIKE ?)", $search, $search, $search]);
 
-               return self::selectToArray([], $condition, $params);
+               return DBA::selectToArray('account-user-view', [], $condition, $params);
        }
 
        /**
index 9acfbfcf98952d4c48da30646b6dd0fd72293722..ffb66d9701343eff98462e73aa28b55333bdf3a6 100644 (file)
@@ -55,7 +55,7 @@
 use Friendica\Database\DBA;
 
 if (!defined('DB_UPDATE_VERSION')) {
-       define('DB_UPDATE_VERSION', 1517);
+       define('DB_UPDATE_VERSION', 1518);
 }
 
 return [
index 0f2201953bfc6be7b6f939757c645bd3d5795d6c..76278c9a24d8f159f0311dfde0a0b40a9ad34524 100644 (file)
                        "site_name" => ["gserver", "site_name"],
                        "platform" => ["gserver", "platform"],
                        "version" => ["gserver", "version"],
+                       "server-blocked" => ["gserver", "blocked"],
+                       "server-failed" => ["gserver", "failed"],
                ],
                "query" => "FROM `contact`
                        LEFT JOIN `item-uri` ON `item-uri`.`id` = `contact`.`uri-id`
                        "site_name" => ["gserver", "site_name"],
                        "platform" => ["gserver", "platform"],
                        "version" => ["gserver", "version"],
+                       "server-blocked" => ["gserver", "blocked"],
+                       "server-failed" => ["gserver", "failed"],
                ],
                "query" => "FROM `contact` AS `ucontact`
                        INNER JOIN `contact` ON `contact`.`uri-id` = `ucontact`.`uri-id` AND `contact`.`uid` = 0