X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=src%2FModule%2FApi%2FMastodon%2FAccounts.php;h=6b88b84ef3fac571fc365743abdfbd1e8888cda8;hb=7486ebdc10715b7204b70ce262052d28cb61c69e;hp=781547854aada3932d0e753ad33726b608ba2e94;hpb=2b95a7e7cd76c573b82b2dbcc5ad08b1501ee89b;p=friendica.git diff --git a/src/Module/Api/Mastodon/Accounts.php b/src/Module/Api/Mastodon/Accounts.php index 781547854a..6b88b84ef3 100644 --- a/src/Module/Api/Mastodon/Accounts.php +++ b/src/Module/Api/Mastodon/Accounts.php @@ -1,6 +1,6 @@ UnprocessableEntity(); + if (empty($this->parameters['id']) && empty($this->parameters['name'])) { + $this->logErrorAndJsonExit(422, $this->errorFactory->UnprocessableEntity()); } - if (!empty($parameters['id'])) { - $id = $parameters['id']; + if (!empty($this->parameters['id'])) { + $id = $this->parameters['id']; if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) { - DI::mstdnError()->RecordNotFound(); + $this->logErrorAndJsonExit(404, $this->errorFactory->RecordNotFound()); } } else { - $contact = Contact::selectFirst(['id'], ['nick' => $parameters['name'], 'uid' => 0]); + $contact = Contact::selectFirst(['id'], ['nick' => $this->parameters['name'], 'uid' => 0]); if (!empty($contact['id'])) { $id = $contact['id']; - } elseif (!($id = Contact::getIdForURL($parameters['name'], 0, false))) { - DI::mstdnError()->RecordNotFound(); + } elseif (!($id = Contact::getIdForURL($this->parameters['name'], 0, false))) { + $this->logErrorAndJsonExit(404, $this->errorFactory->RecordNotFound()); } } $account = DI::mstdnAccount()->createFromContactId($id, $uid); - System::jsonExit($account); + $this->jsonExit($account); } }