diff --git a/database.sql b/database.sql index eefd389840..42a6c1f2e6 100644 --- a/database.sql +++ b/database.sql @@ -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` diff --git a/src/Model/Contact.php b/src/Model/Contact.php index 8792273eef..54689fb624 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -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); } /** diff --git a/static/dbstructure.config.php b/static/dbstructure.config.php index 9acfbfcf98..ffb66d9701 100644 --- a/static/dbstructure.config.php +++ b/static/dbstructure.config.php @@ -55,7 +55,7 @@ use Friendica\Database\DBA; if (!defined('DB_UPDATE_VERSION')) { - define('DB_UPDATE_VERSION', 1517); + define('DB_UPDATE_VERSION', 1518); } return [ diff --git a/static/dbview.config.php b/static/dbview.config.php index 0f2201953b..76278c9a24 100644 --- a/static/dbview.config.php +++ b/static/dbview.config.php @@ -1009,6 +1009,8 @@ "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` @@ -1111,6 +1113,8 @@ "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