Move jsonError out of Factory\Api\Mastodon\Error->UnprocessableEntity

This commit is contained in:
Hypolite Petovan 2023-10-11 09:20:49 -04:00
parent 7f846f153d
commit 7486ebdc10
52 changed files with 76 additions and 73 deletions

View file

@ -38,7 +38,7 @@ class Block extends BaseApi
$uid = self::getCurrentUserID();
if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
$this->logErrorAndJsonExit(422, $this->errorFactory->UnprocessableEntity());
}
Contact\User::setBlocked($this->parameters['id'], $uid, true);

View file

@ -37,7 +37,7 @@ class Follow extends BaseApi
$uid = self::getCurrentUserID();
if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
$this->logErrorAndJsonExit(422, $this->errorFactory->UnprocessableEntity());
}
$request = $this->getRequest([

View file

@ -41,7 +41,7 @@ class Followers extends BaseApi
$uid = self::getCurrentUserID();
if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
$this->logErrorAndJsonExit(422, $this->errorFactory->UnprocessableEntity());
}
$id = $this->parameters['id'];

View file

@ -41,7 +41,7 @@ class Following extends BaseApi
$uid = self::getCurrentUserID();
if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
$this->logErrorAndJsonExit(422, $this->errorFactory->UnprocessableEntity());
}
$id = $this->parameters['id'];

View file

@ -41,7 +41,7 @@ class Lists extends BaseApi
$uid = self::getCurrentUserID();
if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
$this->logErrorAndJsonExit(422, $this->errorFactory->UnprocessableEntity());
}
$id = $this->parameters['id'];

View file

@ -37,7 +37,7 @@ class Mute extends BaseApi
$uid = self::getCurrentUserID();
if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
$this->logErrorAndJsonExit(422, $this->errorFactory->UnprocessableEntity());
}
Contact\User::setIgnored($this->parameters['id'], $uid, true);

View file

@ -38,7 +38,7 @@ class Note extends BaseApi
$uid = self::getCurrentUserID();
if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
$this->logErrorAndJsonExit(422, $this->errorFactory->UnprocessableEntity());
}
$request = $this->getRequest([

View file

@ -44,7 +44,7 @@ class Relationships extends BaseApi
], $request);
if (empty($request['id'])) {
DI::mstdnError()->UnprocessableEntity();
$this->logErrorAndJsonExit(422, $this->errorFactory->UnprocessableEntity());
}
if (!is_array($request['id'])) {

View file

@ -47,7 +47,7 @@ class Statuses extends BaseApi
$uid = self::getCurrentUserID();
if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
$this->logErrorAndJsonExit(422, $this->errorFactory->UnprocessableEntity());
}
$id = $this->parameters['id'];

View file

@ -37,7 +37,7 @@ class Unblock extends BaseApi
$uid = self::getCurrentUserID();
if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
$this->logErrorAndJsonExit(422, $this->errorFactory->UnprocessableEntity());
}
Contact\User::setBlocked($this->parameters['id'], $uid, false);

View file

@ -37,7 +37,7 @@ class Unfollow extends BaseApi
$uid = self::getCurrentUserID();
if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
$this->logErrorAndJsonExit(422, $this->errorFactory->UnprocessableEntity());
}
$cdata = Contact::getPublicAndUserContactID($this->parameters['id'], $uid);

View file

@ -37,7 +37,7 @@ class Unmute extends BaseApi
$uid = self::getCurrentUserID();
if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
$this->logErrorAndJsonExit(422, $this->errorFactory->UnprocessableEntity());
}
Contact\User::setIgnored($this->parameters['id'], $uid, false);