From 60ebc62730fa7e6784a7dfd1bad0ef2b708d9c97 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 13 Aug 2024 01:49:27 +0000 Subject: [PATCH] Issue 14121: Don't display contacts from unavailable networks via API --- src/Module/Api/Mastodon/Accounts/Followers.php | 5 ++++- src/Module/Api/Mastodon/Accounts/Following.php | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Module/Api/Mastodon/Accounts/Followers.php b/src/Module/Api/Mastodon/Accounts/Followers.php index 748d7725e8..be7d3bae26 100644 --- a/src/Module/Api/Mastodon/Accounts/Followers.php +++ b/src/Module/Api/Mastodon/Accounts/Followers.php @@ -21,7 +21,7 @@ namespace Friendica\Module\Api\Mastodon\Accounts; -use Friendica\Core\System; +use Friendica\Content\Widget; use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Contact; @@ -75,6 +75,9 @@ class Followers extends BaseApi $params['order'] = ['pid']; } + $networks = Widget::unavailableNetworks(); + $condition = DBA::mergeConditions($condition, array_merge(["NOT `network` IN (" . substr(str_repeat("?, ", count($networks)), 0, -2) . ")"], $networks)); + $accounts = []; foreach (Contact::selectAccountToArray(['pid'], $condition, $params) as $follower) { diff --git a/src/Module/Api/Mastodon/Accounts/Following.php b/src/Module/Api/Mastodon/Accounts/Following.php index a32e30d470..8d5c48a88b 100644 --- a/src/Module/Api/Mastodon/Accounts/Following.php +++ b/src/Module/Api/Mastodon/Accounts/Following.php @@ -21,7 +21,7 @@ namespace Friendica\Module\Api\Mastodon\Accounts; -use Friendica\Core\System; +use Friendica\Content\Widget; use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Contact; @@ -75,6 +75,9 @@ class Following extends BaseApi $params['order'] = ['pid']; } + $networks = Widget::unavailableNetworks(); + $condition = DBA::mergeConditions($condition, array_merge(["NOT `network` IN (" . substr(str_repeat("?, ", count($networks)), 0, -2) . ")"], $networks)); + $accounts = []; foreach (Contact::selectAccountToArray(['pid'], $condition, $params) as $follower) {