Throw exception when item doesn't exist in Factory\Api\Mastodon\Status->createFromUriId
- Address https://github.com/friendica/friendica/issues/9250#issuecomment-750464977
This commit is contained in:
parent
97bbe3ae96
commit
8c1e2b9800
|
@ -61,6 +61,10 @@ class Status extends BaseFactory
|
||||||
public function createFromUriId(int $uriId, $uid = 0)
|
public function createFromUriId(int $uriId, $uid = 0)
|
||||||
{
|
{
|
||||||
$item = Item::selectFirst([], ['uri-id' => $uriId, 'uid' => $uid]);
|
$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']);
|
$account = DI::mstdnAccount()->createFromContactId($item['author-id']);
|
||||||
|
|
||||||
$counts = new \Friendica\Object\Api\Mastodon\Status\Counts(
|
$counts = new \Friendica\Object\Api\Mastodon\Status\Counts(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user