Merge pull request #13918 from MrPetovan/bug/fixup-13911

Move Api\Mastodon\Instance\Extended to ExtendedDescription
This commit is contained in:
Michael Vogel 2024-02-19 04:05:42 +01:00 committed by GitHub
commit 9ad452a19b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 10 deletions

View file

@ -25,23 +25,22 @@ use DateTime;
use Friendica\App;
use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\L10n;
use Friendica\Database\Database;
use Friendica\Model\User;
use Friendica\Module\Api\ApiResponse;
use Friendica\Module\BaseApi;
use Friendica\Object\Api\Mastodon\ExtendedDescription;
use Friendica\Network\HTTPException;
use Friendica\Object\Api\Mastodon;
use Friendica\Util\Profiler;
use Psr\Log\LoggerInterface;
/**
* Undocumented API endpoint that is implemented by both Mastodon and Pleroma
* @see https://docs.joinmastodon.org/methods/instance/#extended_description
*/
class Extended extends BaseApi
class ExtendedDescription extends BaseApi
{
/** @var IManageConfigValues */
private $config;
private IManageConfigValues $config;
public function __construct(\Friendica\Factory\Api\Mastodon\Error $errorFactory, App $app, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, ApiResponse $response, Database $database, IManageConfigValues $config, array $server, array $parameters = [])
public function __construct(\Friendica\Factory\Api\Mastodon\Error $errorFactory, App $app, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, ApiResponse $response, IManageConfigValues $config, array $server, array $parameters = [])
{
parent::__construct($errorFactory, $app, $l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
@ -55,6 +54,6 @@ class Extended extends BaseApi
{
$account = User::getSystemAccount();
$this->jsonExit(new ExtendedDescription(new DateTime($account['updated']), $this->config->get('config', 'info')));
$this->jsonExit(new Mastodon\ExtendedDescription(new DateTime($account['updated']), $this->config->get('config', 'info')));
}
}

View file

@ -137,7 +137,8 @@ class Search extends BaseApi
private static function searchStatuses(int $uid, string $q, string $account_id, int $max_id, int $min_id, int $limit, int $offset)
{
if (Network::isValidHttpUrl($q)) {
if ($offset != 0) {
// Unique post search, any offset greater than 0 should return empty result
if ($offset > 0) {
return [];
}
$q = Network::convertToIdn($q);

View file

@ -254,7 +254,7 @@ return [
'/instance' => [Module\Api\Mastodon\Instance::class, [R::GET ]],
'/instance/activity' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // @todo
'/instance/domain_blocks' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // @todo
'/instance/extended_description' => [Module\Api\Mastodon\Instance\Extended::class, [R::GET ]],
'/instance/extended_description' => [Module\Api\Mastodon\Instance\ExtendedDescription::class, [R::GET ]],
'/instance/peers' => [Module\Api\Mastodon\Instance\Peers::class, [R::GET ]],
'/instance/rules' => [Module\Api\Mastodon\Instance\Rules::class, [R::GET ]],
'/lists' => [Module\Api\Mastodon\Lists::class, [R::GET, R::POST]],