Merge pull request #9711 from MrPetovan/bug/fatal-errors

Throw exception when item doesn't exist in Factory\Api\Mastodon\Status->createFromUriId
This commit is contained in:
Michael Vogel 2020-12-28 07:04:08 +01:00 committed by GitHub
commit 2edad06972
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -61,6 +61,10 @@ class Status extends BaseFactory
public function createFromUriId(int $uriId, $uid = 0)
{
$item = Item::selectFirst([], ['uri-id' => $uriId, 'uid' => $uid]);
if (!$item) {
throw new HTTPException\NotFoundException('Item with URI ID ' . $uriId . 'not found' . ($uid ? ' for user ' . $uid : '.'));
}
$account = DI::mstdnAccount()->createFromContactId($item['author-id']);
$counts = new \Friendica\Object\Api\Mastodon\Status\Counts(