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

This commit is contained in:
Hypolite Petovan
2023-10-11 09:16:03 -04:00
parent 9e71610711
commit 7f846f153d
36 changed files with 68 additions and 56 deletions

View File

@@ -81,10 +81,10 @@ class Media extends BaseApi
if (empty($photo['resource-id'])) {
$media = Post\Media::getById($this->parameters['id']);
if (empty($media['uri-id'])) {
DI::mstdnError()->RecordNotFound();
$this->logErrorAndJsonExit(404, $this->errorFactory->RecordNotFound());
}
if (!Post::exists(['uri-id' => $media['uri-id'], 'uid' => $uid, 'origin' => true])) {
DI::mstdnError()->RecordNotFound();
$this->logErrorAndJsonExit(404, $this->errorFactory->RecordNotFound());
}
Post\Media::updateById(['description' => $request['description']], $this->parameters['id']);
$this->jsonExit(DI::mstdnAttachment()->createFromId($this->parameters['id']));
@@ -109,7 +109,7 @@ class Media extends BaseApi
$id = $this->parameters['id'];
if (!Photo::exists(['id' => $id, 'uid' => $uid])) {
DI::mstdnError()->RecordNotFound();
$this->logErrorAndJsonExit(404, $this->errorFactory->RecordNotFound());
}
$this->jsonExit(DI::mstdnAttachment()->createFromPhoto($id));