X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FApi%2FMastodon%2FLists%2FAccounts.php;h=feb670b271182644400a5353212e7744df9ca73a;hb=87084a3e854b72290fcc49e66fd0ccdf737672ee;hp=6e10ad6bfa84f0c91bb4fd75ebd2fa2430fb1c1a;hpb=2b95a7e7cd76c573b82b2dbcc5ad08b1501ee89b;p=friendica.git diff --git a/src/Module/Api/Mastodon/Lists/Accounts.php b/src/Module/Api/Mastodon/Lists/Accounts.php index 6e10ad6bfa..feb670b271 100644 --- a/src/Module/Api/Mastodon/Lists/Accounts.php +++ b/src/Module/Api/Mastodon/Lists/Accounts.php @@ -21,9 +21,11 @@ namespace Friendica\Module\Api\Mastodon\Lists; +use Friendica\App\Router; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\DI; +use Friendica\Module\Api\ApiResponse; use Friendica\Module\BaseApi; /** @@ -33,39 +35,37 @@ use Friendica\Module\BaseApi; */ class Accounts extends BaseApi { - public static function delete(array $parameters = []) + public function delete() { - self::unsupported('delete'); + DI::apiResponse()->unsupported(Router::DELETE); } - public static function post(array $parameters = []) + public function post() { - self::unsupported('post'); + DI::apiResponse()->unsupported(Router::POST); } /** - * @param array $parameters * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public static function rawContent(array $parameters = []) + public function rawContent() { self::checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); - if (empty($parameters['id'])) { + if (empty($this->parameters['id'])) { DI::mstdnError()->UnprocessableEntity(); } - $id = $parameters['id']; + $id = $this->parameters['id']; if (!DBA::exists('group', ['id' => $id, 'uid' => $uid])) { DI::mstdnError()->RecordNotFound(); } - // @todo provide HTTP link header - $request = self::getRequest([ 'max_id' => 0, // Return results older than this id 'since_id' => 0, // Return results newer than this id + 'min_id' => 0, // Return results immediately newer than id 'limit' => 40, // Maximum number of results. Defaults to 40. Max 40. Set to 0 in order to get all accounts without pagination. ]); @@ -74,7 +74,7 @@ class Accounts extends BaseApi if ($request['limit'] != 0) { $params['limit'] = min($request['limit'], 40); } - + $condition = ['gid' => $id]; if (!empty($request['max_id'])) { @@ -85,8 +85,8 @@ class Accounts extends BaseApi $condition = DBA::mergeConditions($condition, ["`contact-id` > ?", $request['since_id']]); } - if (!empty($min_id)) { - $condition = DBA::mergeConditions($condition, ["`contact-id` > ?", $min_id]); + if (!empty($request['min_id'])) { + $condition = DBA::mergeConditions($condition, ["`contact-id` > ?", $request['min_id']]); $params['order'] = ['contact-id']; } @@ -100,7 +100,7 @@ class Accounts extends BaseApi } DBA::close($members); - if (!empty($min_id)) { + if (!empty($request['min_id'])) { array_reverse($accounts); }