From c335754decba654611ef34162df23fe7376a0271 Mon Sep 17 00:00:00 2001 From: Art4 Date: Mon, 13 Jan 2025 12:07:05 +0000 Subject: [PATCH] Change static methods to dynamic in Mastodon Search class --- src/Module/Api/Mastodon/Search.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Module/Api/Mastodon/Search.php b/src/Module/Api/Mastodon/Search.php index 831ac010f8..532b45dd99 100644 --- a/src/Module/Api/Mastodon/Search.php +++ b/src/Module/Api/Mastodon/Search.php @@ -53,7 +53,7 @@ class Search extends BaseApi $result = ['accounts' => [], 'statuses' => [], 'hashtags' => []]; if (empty($request['type']) || ($request['type'] == 'accounts')) { - $result['accounts'] = self::searchAccounts($uid, $request['q'], $request['resolve'], $limit, $request['offset'], $request['following']); + $result['accounts'] = $this->searchAccounts($uid, $request['q'], $request['resolve'], $limit, $request['offset'], $request['following']); if (!is_array($result['accounts'])) { // Curbing the search if we got an exact result @@ -63,7 +63,7 @@ class Search extends BaseApi } if (empty($request['type']) || ($request['type'] == 'statuses')) { - $result['statuses'] = self::searchStatuses($uid, $request['q'], $request['account_id'], $request['max_id'], $request['min_id'], $limit, $request['offset']); + $result['statuses'] = $this->searchStatuses($uid, $request['q'], $request['account_id'], $request['max_id'], $request['min_id'], $limit, $request['offset']); if (!is_array($result['statuses'])) { // Curbing the search if we got an exact result @@ -73,7 +73,7 @@ class Search extends BaseApi } if ((empty($request['type']) || ($request['type'] == 'hashtags')) && (strpos($request['q'], '@') == false)) { - $result['hashtags'] = self::searchHashtags($request['q'], $request['exclude_unreviewed'], $limit, $request['offset'], $this->parameters['version']); + $result['hashtags'] = $this->searchHashtags($request['q'], $request['exclude_unreviewed'], $limit, $request['offset'], $this->parameters['version']); } $this->jsonExit($result); @@ -91,7 +91,7 @@ class Search extends BaseApi * @throws \Friendica\Network\HTTPException\NotFoundException * @throws \ImagickException */ - private static function searchAccounts(int $uid, string $q, bool $resolve, int $limit, int $offset, bool $following) + private function searchAccounts(int $uid, string $q, bool $resolve, int $limit, int $offset, bool $following) { if (($offset == 0) && (strrpos($q, '@') > 0 || Network::isValidHttpUrl($q)) && $id = Contact::getIdForURL($q, 0, $resolve ? null : false) @@ -120,7 +120,7 @@ class Search extends BaseApi * @throws \Friendica\Network\HTTPException\NotFoundException * @throws \ImagickException */ - private static function searchStatuses(int $uid, string $q, string $account_id, int $max_id, int $min_id, int $limit, int $offset) + private function searchStatuses(int $uid, string $q, string $account_id, int $max_id, int $min_id, int $limit, int $offset) { if (Network::isValidHttpUrl($q)) { // Unique post search, any offset greater than 0 should return empty result @@ -185,7 +185,7 @@ class Search extends BaseApi return $statuses; } - private static function searchHashtags(string $q, bool $exclude_unreviewed, int $limit, int $offset, int $version): array + private function searchHashtags(string $q, bool $exclude_unreviewed, int $limit, int $offset, int $version): array { $q = ltrim($q, '#');